Advertisement
DrawingJhon

Fixed Snake

Aug 17th, 2022 (edited)
713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.11 KB | None | 0 0
  1. IT = Instance.new
  2. CF = CFrame.new
  3. VT = Vector3.new
  4. RAD = math.rad
  5. C3 = Color3.new
  6. UD2 = UDim2.new
  7. BRICKC = BrickColor.new
  8. ANGLES = CFrame.Angles
  9. EULER = CFrame.fromEulerAnglesXYZ
  10. COS = math.cos
  11. ACOS = math.acos
  12. SIN = math.sin
  13. ASIN = math.asin
  14. ABS = math.abs
  15. MRANDOM = math.random
  16. FLOOR = math.floor
  17.  
  18. speed = 1
  19. sine = 1
  20. srv = game:GetService('RunService')
  21.  
  22. local plr = game.Players.LocalPlayer
  23. reanim = plr.Character
  24.  
  25. reanim.Animate.Disabled = true
  26.  
  27. for i, v in pairs(reanim.Humanoid:GetPlayingAnimationTracks()) do
  28.     v:Stop()
  29. end
  30.  
  31. for _, child in pairs(reanim:GetChildren()) do
  32.     if child:IsA("Tool") then
  33.         child.Parent = plr:FindFirstChildOfClass("Backpack")
  34.     end
  35. end
  36.  
  37. local parts = reanim:GetDescendants()
  38. local actived = false
  39.  
  40. local netless = game:GetService("RunService").Heartbeat:Connect(function()
  41.     if not actived then return end
  42.     for i, v in pairs(parts) do
  43.         if v:IsA("BasePart") then
  44.             v.AssemblyLinearVelocity = Vector3.new(-30,0,0)
  45.         end
  46.     end
  47.     sethiddenproperty(plr,"MaximumSimulationRadius",math.huge)
  48.     sethiddenproperty(plr,"SimulationRadius",999999999)
  49. end)
  50.  
  51. local noclip; noclip = game:GetService("RunService").Stepped:Connect(function()
  52.     if not reanim:IsDescendantOf(workspace) then
  53.         noclip:Disconnect()
  54.         return
  55.     end
  56.     for i, v in pairs(parts) do
  57.         if v:IsA("BasePart") then
  58.             v.CanCollide = false
  59.         end
  60.     end
  61. end)
  62.  
  63. local uis = game:GetService("UserInputService")
  64. local player = game:GetService("Players").LocalPlayer
  65.  
  66. local HumanDied = false
  67.  
  68. local model = Instance.new("Model", workspace)
  69. local root = Instance.new("Part", model)
  70. root.Name = "HumanoidRootPart"
  71. root.Size = Vector3.new(2, 2, 1)
  72. root.Position = reanim.HumanoidRootPart.Position
  73. root.CanCollide = false
  74. root.Transparency =  0.9
  75. local torso = root:Clone()
  76. torso.Name = "Torso"
  77. torso.Transparency = 1
  78. local weld = Instance.new("Weld", torso)
  79. weld.Part0 = torso
  80. weld.Part1 = root
  81. weld.C0 = CFrame.new(0, -2, 0)
  82. torso.Parent = model
  83. torso.Massless = true
  84. local rarm = Instance.new("Part", model)
  85. rarm.Name = "Right Arm"
  86. rarm.CanCollide = false
  87. rarm.Transparency = 1
  88. rarm.Massless = true
  89. rarm.Size = Vector3.new(1, 2, 1)
  90. local motor = Instance.new("Motor6D", torso)
  91. motor.Part0 = torso
  92. motor.Part1 = rarm
  93. motor.C0 = CFrame.new(1, 1, 0)
  94. motor.Name = "Right Shoulder"
  95. local hum = Instance.new("Humanoid", model)
  96. hum.HipHeight = 2
  97. hum.AutoJumpEnabled = false
  98.  
  99. local cn; cn = hum.Died:Connect(function()
  100.     print("Dead")
  101.     plr.Character = reanim
  102.     HumanDied = true
  103.     model:Destroy()
  104.     netless:Disconnect()
  105.     plr.Character:BreakJoints()
  106.     cn:Disconnect()
  107. end)
  108.  
  109. reanim.Changed:Connect(function()
  110.     if not reanim:IsDescendantOf(workspace) then
  111.         HumanDied = true
  112.         model:Destroy()
  113.     end
  114. end)
  115.  
  116. function create(weld)
  117.     print(weld.Part1)
  118.     local part = weld.Part1
  119.     local att0 = Instance.new("Attachment", part)
  120.     local att1 = Instance.new("Attachment", torso)
  121.     local alignPos = Instance.new("AlignPosition", part)
  122.     local alignOr = Instance.new("AlignOrientation", part)
  123.  
  124.     alignPos.Attachment0 = att0
  125.     alignPos.Attachment1 = att1
  126.     alignPos.MaxForce = 999999999
  127.     alignPos.MaxVelocity = math.huge
  128.     alignPos.ReactionForceEnabled = false
  129.     alignPos.Responsiveness = math.huge
  130.     alignPos.RigidityEnabled = false
  131.     alignPos.Mode = "TwoAttachment"
  132.  
  133.     alignOr.Attachment0 = att0
  134.     alignOr.Attachment1 = att1
  135.     alignOr.Responsiveness = math.huge
  136.     alignOr.MaxTorque = 999999999
  137.     alignOr.Mode = "TwoAttachment"
  138.  
  139.     weld:Destroy()
  140.     --table.insert(parts, part)
  141.  
  142.     return setmetatable({}, {
  143.         __index = function(self, index)
  144.             if index == "C1" then
  145.                 return att0.CFrame
  146.             elseif index == "C0" then
  147.                 return att1.CFrame
  148.             end
  149.             return weld[index]
  150.         end,
  151.         __newindex = function(self, index, value)
  152.             if index == "C1" then
  153.                 att0.CFrame = value
  154.             elseif index == "C0" then
  155.                 att1.CFrame = value
  156.             else
  157.                 weld[index] = value
  158.             end
  159.         end
  160.     })
  161. end
  162.  
  163. Root = reanim.HumanoidRootPart
  164. Root.CanCollide = false
  165.  
  166. local lastPos = Root.Position
  167.  
  168. wait()
  169.  
  170. local bv = Instance.new("BodyVelocity")
  171. bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  172. bv.Velocity = Vector3.new()
  173. bv.Parent = Root
  174. --reanim:PivotTo(reanim:GetPivot() * CFrame.new(0, -10, 0))
  175. Root.CFrame = CFrame.new(lastPos) * CFrame.new(0, -10, 0)
  176.  
  177. m=game.Players.LocalPlayer:GetMouse()
  178. RJ = {C0 = CFrame.new(); C1 = CFrame.new()}
  179. RS = create(reanim.Torso['Right Shoulder'])
  180. LS = create(reanim.Torso['Left Shoulder'])
  181. RH = create(reanim.Torso['Right Hip'])
  182. LH = create(reanim.Torso['Left Hip'])
  183. NECK = {C0 = CFrame.new(); C1 = CFrame.new()}
  184. Root = reanim.HumanoidRootPart
  185. NECK = reanim.Torso.Neck
  186. NECK.C0 = CF(0,1,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  187. NECK.C1 = CF(0,-0.5,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  188. RJ.C1 = CF(0,-1,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  189. RJ.C0 = CF(0,0,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  190. RS.C1 = CF(0,0.5,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  191. LS.C1 = CF(0,0.5,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  192. RH.C1 = CF(0,1,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  193. LH.C1 = CF(0,1,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  194. RH.C0 = CF(0,0,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  195. LH.C0 = CF(0,0,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  196. RS.C0 = CF(0,0,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  197. LS.C0 = CF(0,0,0)*ANGLES(RAD(0),RAD(0),RAD(0))
  198.  
  199. root.Position = lastPos + Vector3.new(0, 3, 0)
  200. player.Character = model
  201. workspace.CurrentCamera.CameraSubject = hum
  202.  
  203. wait()
  204.  
  205. actived = true
  206.  
  207. local Root = root
  208.  
  209. coroutine.wrap(function()
  210. while true do -- anim changer
  211. if HumanDied then break end
  212. sine = sine + speed
  213. local rlegray = Ray.new(reanim["Right Leg"].Position + Vector3.new(0, 0.5, 0), Vector3.new(0, -2, 0))
  214. local rlegpart, rlegendPoint = workspace:FindPartOnRay(rlegray, char)
  215. local llegray = Ray.new(reanim["Left Leg"].Position + Vector3.new(0, 0.5, 0), Vector3.new(0, -2, 0))
  216. local llegpart, llegendPoint = workspace:FindPartOnRay(llegray, char)
  217. local rightvector = (Root.Velocity * Root.CFrame.rightVector).X + (Root.Velocity * Root.CFrame.rightVector).Z
  218. local lookvector = (Root.Velocity * Root.CFrame.lookVector).X + (Root.Velocity * Root.CFrame.lookVector).Z
  219. if lookvector > hum.WalkSpeed then
  220. lookvector = hum.WalkSpeed
  221. end
  222. if lookvector < -hum.WalkSpeed then
  223. lookvector = -hum.WalkSpeed
  224. end
  225. if rightvector > hum.WalkSpeed then
  226. rightvector = hum.WalkSpeed
  227. end
  228. if rightvector < -hum.WalkSpeed then
  229. rightvector = -hum.WalkSpeed
  230. end
  231. local lookvel = lookvector / hum.WalkSpeed
  232. local rightvel = rightvector / hum.WalkSpeed
  233. if hum.Jump then -- jump
  234. NECK.C0=NECK.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),1+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  235. RJ.C0=RJ.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),2.54+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  236. RS.C0=RS.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),0+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  237. LS.C0=LS.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.76+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  238. RH.C0=RH.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-2.83+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  239. LH.C0=LH.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-4.44+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  240. elseif Root.Velocity.y < -1 and hum.Jump then -- fall
  241. NECK.C0=NECK.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),1+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  242. RJ.C0=RJ.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),2.54+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  243. RS.C0=RS.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),0+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  244. LS.C0=LS.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.76+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  245. RH.C0=RH.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-2.83+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  246. LH.C0=LH.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-4.44+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  247. elseif Root.Velocity.Magnitude < 2 then -- idle
  248. NECK.C0=NECK.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),1+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  249. RJ.C0=RJ.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-2+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  250. RS.C0=RS.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),0.93+0*math.cos(sine/10))*CFrame.Angles(math.rad(120.21+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  251. LS.C0=LS.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),1.47+0*math.cos(sine/10))*CFrame.Angles(math.rad(270+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  252. RH.C0=RH.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),2.9+0*math.cos(sine/10))*CFrame.Angles(math.rad(242.48+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+5.58*math.cos(sine/10))),.2)
  253. LH.C0=LH.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-0.68+0*math.cos(sine/10),4.69+0*math.cos(sine/10))*CFrame.Angles(math.rad(219.55+13.23*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+59.08*math.cos(sine/10))),.2)
  254. elseif Root.Velocity.Magnitude < 20 then -- walk
  255. NECK.C0=NECK.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),1+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  256. RJ.C0=RJ.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-2+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  257. RS.C0=RS.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),0.93+0*math.cos(sine/10))*CFrame.Angles(math.rad(120.21+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  258. LS.C0=LS.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),1.47+0*math.cos(sine/10))*CFrame.Angles(math.rad(270+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  259. RH.C0=RH.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),2.9+0*math.cos(sine/10))*CFrame.Angles(math.rad(270+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+2*math.cos(sine/10))),.2)
  260. LH.C0=LH.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),4.69+0*math.cos(sine/10))*CFrame.Angles(math.rad(270+-2.06*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+28.51*math.cos(sine/10))),.2)
  261. elseif Root.Velocity.Magnitude > 20 then -- run
  262. NECK.C0=NECK.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),1+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  263. RJ.C0=RJ.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-2+0*math.cos(sine/10),0+0*math.cos(sine/10))*CFrame.Angles(math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  264. RS.C0=RS.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),0.93+0*math.cos(sine/10))*CFrame.Angles(math.rad(120.21+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  265. LS.C0=LS.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),1.47+0*math.cos(sine/10))*CFrame.Angles(math.rad(270+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10))),.2)
  266. RH.C0=RH.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),2.9+0*math.cos(sine/10))*CFrame.Angles(math.rad(270+0*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+2*math.cos(sine/10))),.2)
  267. LH.C0=LH.C0:Lerp(CFrame.new(0+0*math.cos(sine/10),-1.5+0*math.cos(sine/10),4.69+0*math.cos(sine/10))*CFrame.Angles(math.rad(270+-2.06*math.cos(sine/10)),math.rad(0+0*math.cos(sine/10)),math.rad(0+28.51*math.cos(sine/10))),.2)
  268. end
  269. srv.RenderStepped:Wait()
  270. end
  271. model:Destroy()
  272. end)()
  273. --Created using Nexo Animator V4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement