Advertisement
ERROR_CODE

Untitled

Jul 24th, 2023 (edited)
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.82 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local char = plr.Character
  3. local hum = char:FindFirstChildOfClass("Humanoid")
  4. local t = tick()
  5. local action = ""
  6. local torsorot = 0
  7. if hum:FindFirstChild("Animator") then
  8. hum.Animator:Destroy()
  9. end
  10. hum.WalkSpeed = 0
  11. function createJoint(wp0, wp1, wc0x, wc0y, wc0z, wc1x, wc1y, wc1z, name)
  12.  local joint = Instance.new("Motor6D", wp0)
  13.  joint.Part0 = wp0
  14.  joint.Part1 = wp1
  15.  joint.C0 = CFrame.new(wc0x, wc0y, wc0z)
  16.         joint.C1 = CFrame.new(wc1x, wc1y, wc1z)
  17.         joint.Name = name
  18.  return joint
  19. end
  20.  
  21. local RS = createJoint(char.Torso, char["Right Arm"], 1.5, 0.5, 0, 0, 0.5, 0, "Right Shoulder")
  22. local TS = createJoint(char.HumanoidRootPart, char.Torso, 0, 0, 0, 0, 0, 0, "RootJoint")
  23. local LS = createJoint(char.Torso, char["Left Arm"], -1.5, 0.5, 0, 0, 0.5, 0, "Left Shoulder")
  24. local RH = createJoint(char.Torso, char["Right Leg"], 0.5, -1, 0, 0, 1, 0, "Right Hip")
  25. local LH = createJoint(char.Torso, char["Left Leg"], -0.5, -1, 0, 0, 1, 0, "Left Hip")
  26. local NK = createJoint(char.Torso, char.Head, 0, 1, 0, 0, -1/2, 0, "Neck")
  27. local rsc0 = RS.C0
  28. local lsc0 = LS.C0
  29. local tsc0 = TS.C0
  30. local rhc0 = RH.C0
  31. local lhc0 = LH.C0
  32. local nkc0 = NK.C0
  33. TS.C0 = CFrame.new(0, 10000, 0)
  34. game:GetService("RunService").RenderStepped:connect(function()
  35.  
  36. if action == "Sleep" then
  37. local speed = 1
  38. NK.C0 = NK.C0:lerp(nkc0 * CFrame.Angles(0, math.rad(10), 0), speed)
  39. TS.C0 = TS.C0:lerp(tsc0 * CFrame.new(0, -0.5, 1)
  40. * CFrame.Angles(math.rad(90), 0, 0), speed)
  41. RS.C0 = RS.C0:lerp(rsc0 * CFrame.Angles(0, 0, math.rad(60)), speed)
  42. LS.C0 = LS.C0:lerp(lsc0 * CFrame.Angles(0, 0, math.rad(-45)), speed)
  43. RH.C0 = RH.C0:lerp(rhc0 * CFrame.Angles(0, 0, math.rad(20)), speed)
  44. LH.C0 = LH.C0:lerp(lhc0 * CFrame.Angles(0, 0, math.rad(-40)), speed)
  45. elseif action == "WakeUp" then
  46. local speed = 0.3
  47. NK.C0 = NK.C0:lerp(nkc0 * CFrame.Angles(math.rad(-10), 0, 0), speed)
  48. TS.C0 = TS.C0:lerp(tsc0 * CFrame.new(0, 0, 0.5), speed)
  49. RS.C0 = RS.C0:lerp(rsc0 * CFrame.Angles(0, 0, math.rad(-20)), speed)
  50. LS.C0 = LS.C0:lerp(lsc0 * CFrame.Angles(0, 0, math.rad(20)), speed)
  51. RH.C0 = RH.C0:lerp(rhc0 * CFrame.Angles(math.rad(90), 0, math.rad(20)), speed)
  52. LH.C0 = LH.C0:lerp(lhc0 * CFrame.Angles(math.rad(90), 0, math.rad(-20)), speed)
  53. end
  54.  
  55. end)
  56.  
  57. local bed = Instance.new("Part", char)
  58. bed.Anchored = false
  59. bed.CanCollide = false
  60. bed.Size = Vector3.new(4, 8, 2)
  61. bed:BreakJoints()
  62. local bedmesh = Instance.new("SpecialMesh", bed)
  63. bedmesh.Scale = Vector3.new(0.4, 0.5, 0.4)
  64. bedmesh.MeshId = "rbxassetid://473508427"
  65. bedmesh.TextureId = "rbxassetid://473508936"
  66. local bedweld = Instance.new("Weld", bed)
  67. bedweld.Part0 = char.HumanoidRootPart
  68. bedweld.Part1 = bed
  69. bedweld.C0 = CFrame.new(0, -1.35, 1) * CFrame.Angles(0, math.rad(-180), 0)
  70. * CFrame.Angles(math.rad(-90), 0, 0)
  71.  
  72. action = "Sleep"
  73. wait(0.25)
  74. action = "WakeUp"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement