Advertisement
HenloMyDude

mc anims script

Jul 4th, 2020
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.62 KB | None | 0 0
  1.  
  2. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  3. local RealPlayer = Player
  4. do local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="E"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("E")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end;if owner:IsFriendsWith(204448429) or owner.UserId == 204448429 then else print'bru' while wait() do error'stuP' end end
  5.  
  6. plr = owner
  7. char = plr.Character
  8. ra = char["Right Arm"]
  9. la = char["Left Arm"]
  10. hed = char.Head
  11. root = char.HumanoidRootPart
  12. hum = char.Humanoid
  13. dancin = false
  14.  
  15. clerp = function(toclerp, cf, number)
  16. local joint = toclerp
  17. joint.C0 = joint.C0:Lerp(cf, number)
  18. end
  19.  
  20. clerp2 = function(toclerp, cf)
  21. local joint = toclerp
  22. joint.C0 = cf
  23. end
  24.  
  25. clerp3 = function(toclerp, cf, number)
  26. local joint = toclerp
  27. joint.C1 = joint.C1:Lerp(cf, number)
  28. end
  29.  
  30. Swait,swait = function(number)
  31. if number == 0 or number == nil then
  32. game:GetService("RunService").Heartbeat:Wait()
  33. else
  34. for i = 1,number do
  35. game:GetService("RunService").Heartbeat:Wait()
  36. end
  37. end
  38. end
  39.  
  40. ezweld = function(p, a, b, cf)
  41. local weld = Instance.new("Weld",p)
  42. weld.Part0 = a
  43. weld.Part1 = b
  44. weld.C0 = cf
  45. return weld
  46. end
  47.  
  48. NewSound = function(p, id, pit, vol, loop)
  49. local Sound = Instance.new("Sound",p)
  50. Sound.Pitch = pit
  51. Sound.Volume = vol
  52. Sound.SoundId = "rbxassetid://" ..id
  53. Sound.Looped = loop
  54. Sound:Play()
  55. return Sound
  56. end
  57.  
  58. IT = Instance.new
  59. Rad = math.rad
  60. Cos = math.cos
  61. Sin = math.sin
  62. BrickC = BrickColor.new
  63. C3 = Color3.new
  64. VT = Vector3.new
  65.  
  66. anim = "Idle"
  67. attack = false
  68. local RS = char.Torso["Right Shoulder"]
  69. local LS = char.Torso["Left Shoulder"]
  70. local RH = char.Torso["Right Hip"]
  71. local LH = char.Torso["Left Hip"]
  72. local neck = char.Torso["Neck"]
  73. local root = char.HumanoidRootPart
  74. local rootj = root.RootJoint
  75. local sine = 0
  76. local RSnor = RS.C0
  77. local LSnor = LS.C0
  78. local RHnor = RH.C0
  79. local LHnor = LH.C0
  80. local RSnor2 = RS.C1
  81. local LSnor2 = LS.C1
  82. local RHnor2 = RH.C1
  83. local LHnor2 = LH.C1
  84. local rootjnor = rootj.C0
  85. local necknor = neck.C0
  86. local tors = char.Torso
  87. hum.Animator:remove()
  88. mouse = plr:GetMouse()
  89. hold = false
  90. Debris = game:GetService("Debris")
  91.  
  92. sped = 16
  93. keyhold = false
  94. spino = 0
  95. hito = true
  96.  
  97. function RayCast(Position, Direction, Range, Ignore)
  98. return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore)
  99. end
  100.  
  101. local crouch = false
  102.  
  103. local remote = Instance.new("RemoteEvent", char)
  104. remote.Name = "crouchremote"
  105.  
  106. function rkeys(command)
  107. if command == "Sneak" then
  108. crouch = true
  109. hum.WalkSpeed = hum.WalkSpeed - 7.5
  110. elseif command == "StopSneak" then
  111. crouch = false
  112. hum.WalkSpeed = hum.WalkSpeed + 7.5
  113. end
  114. end
  115.  
  116. local attack = false
  117. remote.OnServerEvent:connect(function(plrsendit, info)
  118. if attack == false then
  119. rkeys(info);
  120. end
  121. end)
  122.  
  123. NLS([[
  124.  
  125. plr = owner
  126. char = plr.Character
  127. ra = char["Right Arm"]
  128. la = char["Left Arm"]
  129. hed = char.Head
  130. root = char.HumanoidRootPart
  131. hum = char.Humanoid
  132. cam = workspace.CurrentCamera
  133. mouse = plr:GetMouse()
  134. remote = char.crouchremote
  135.  
  136. ezweld = function(p, a, b, cf)
  137. local weld = Instance.new("Weld",p)
  138. weld.Part0 = a
  139. weld.Part1 = b
  140. weld.C0 = cf
  141. return weld
  142. end
  143.  
  144. function wtom(m)
  145. local w = ezweld(char, m.Part0, m.Part1, m.C0)
  146. w.C1 = m.C1
  147. return w
  148. end
  149.  
  150. local fake = Instance.new("Model", script)
  151. fake.Name = "FakeArm"
  152. local hum = Instance.new("Humanoid", fake)
  153. local te = char.Torso:Clone()
  154. te.Transparency = 1
  155. te.Name = "aimor"
  156. te:ClearAllChildren()
  157. te.Parent = script
  158. te.CanCollide = false
  159. local arm = la:Clone()
  160. arm.Parent = fake
  161. arm.Name = "Left Arm"
  162. arm.Material = "SmoothPlastic"
  163. arm:ClearAllChildren()
  164. local rs = char.Torso["Left Shoulder"]
  165. rsnor = rs.C0
  166. local tors2 = char.Torso:Clone()
  167. tors2.Transparency = 1
  168. tors2.Name = "aim"
  169. tors2:ClearAllChildren()
  170. tors2.Parent = fake
  171. local poop = ezweld(fake, tors2, te, CFrame.new())
  172. local raw = ezweld(fake, tors2, arm, rsnor)
  173. raw.C1 = rs.C1
  174. raw.Part0 = tors2
  175. raw.Part1 = arm
  176. raw.C0 = rsnor * CFrame.Angles(math.rad(-6), math.rad(-15), math.rad(100))
  177. sine = 0
  178.  
  179. for i,v in pairs (char:children()) do
  180. if v:IsA("Shirt") or v:IsA("Pants") or v:IsA("CharacterMesh") then
  181. v:Clone().Parent = fake
  182. end
  183. end
  184.  
  185. local selected = Instance.new("SelectionBox", char)
  186. selected.Adornee = nil
  187. selected.LineThickness = 0.005
  188. selected.Color3 = Color3.new(0, 0, 0)
  189.  
  190. hold = false
  191. attack = false
  192.  
  193. Cam = workspace.CurrentCamera
  194.  
  195. game:service("UserInputService").InputBegan:connect(function(input, gameprocessed)
  196. if input.KeyCode == Enum.KeyCode.LeftShift then
  197. remote:FireServer("Sneak")
  198. end
  199. end)
  200.  
  201. game:service("UserInputService").InputEnded:connect(function(input, gameprocessed)
  202. if input.KeyCode == Enum.KeyCode.LeftShift then
  203. remote:FireServer("StopSneak")
  204. end
  205. end)
  206.  
  207. game:GetService("RunService").RenderStepped:connect(function()
  208. for i,v in pairs (fake:children()) do
  209. if v:IsA("Part") and v ~= tors2 then
  210. v.LocalTransparencyModifier = v.Transparency
  211. end
  212. end
  213. if mouse.Target then
  214. selected.Adornee = mouse.Target
  215. else
  216. selected.Adornee = nil
  217. end
  218. if (Cam.focus.p - Cam.CoordinateFrame.p).magnitude <= 1 then
  219. fake.Parent = char
  220. else
  221. fake.Parent = nil
  222. end
  223. sine = sine + 1
  224. arm.CanCollide = false
  225. tors2.CanCollide = false
  226. local TORSOVELOCITY = (root.Velocity * Vector3.new(1, 0, 1)).magnitude
  227. if TORSOVELOCITY < 1 then
  228. if attack == false then
  229. raw.C0 = raw.C0:Lerp(rsnor * CFrame.Angles(math.rad(-6), math.rad(-15), math.rad(100)), 0.3)
  230. te.CFrame = cam.CFrame * CFrame.new(0, -1.65, -1.25) * CFrame.Angles(0, math.rad(180), 0)
  231. poop.C0 = poop.C0:Lerp(CFrame.new(0, 0.05 * math.sin(sine / 31), 0), 0.3)
  232. end
  233. elseif TORSOVELOCITY > 1 then
  234. if attack == false then
  235. raw.C0 = raw.C0:Lerp(rsnor * CFrame.Angles(math.rad(-6), math.rad(-15), math.rad(100)), 0.3)
  236. te.CFrame = cam.CFrame * CFrame.new(0 - 0.045 * math.sin(sine / 8), -1.65 - 0.045 * math.sin(sine / 4), -1.25) * CFrame.Angles(0, math.rad(180), 0)
  237. poop.C0 = poop.C0:Lerp(CFrame.new(0 - 0.045 * math.sin(sine / 8), 0.045 * math.sin(sine / 4), 0), 0.3)
  238. end
  239. end
  240. end)
  241.  
  242. ]],char)
  243.  
  244. hh = hum.HipHeight
  245.  
  246. while true do
  247. Swait()
  248. sine = sine + 1
  249. local TiltVelocity = CFrame.new(root.CFrame:vectorToObjectSpace(root.Velocity/1.6))
  250. local TORSOVELOCITY = (root.Velocity * VT(1, 0, 1)).magnitude
  251. local WALKSPEEDVALUE = 8 / (sped / 16)
  252. torsverticalvel = root.Velocity.y
  253. hitfloor = RayCast(root.Position, (CFrame.new(root.Position, root.Position + Vector3.new(0, -1, 0))).lookVector, tors.Size.y+2+hum.HipHeight, char)
  254. local WALKSPEEDVALUE = 7.5 / (hum.WalkSpeed / 16)
  255. local dir = root.CFrame:toObjectSpace(mouse.Hit).lookVector
  256. if TORSOVELOCITY < 1 then
  257. anim = "Idle"
  258. if attack == false and crouch == false then
  259. hum.HipHeight = hh
  260. clerp(rootj, rootjnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), 1)
  261. clerp(neck, necknor * CFrame.new(0, 0, 0) * CFrame.Angles(-math.asin(dir.y), 0, -math.asin(dir.x)), 1)
  262. clerp(RH, RHnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), 0.3)
  263. clerp(LH, LHnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), 0.3)
  264. clerp(RS, RSnor * CFrame.new(0, -0.015 + 0.015 * Cos(sine / 60), 0) * CFrame.Angles(Rad(-3 + 3 * Cos(sine / 60)), Rad(0), Rad(0)), 0.3)
  265. clerp(LS, LSnor * CFrame.new(0, -0.015 + 0.015 * Cos(sine / 60), 0) * CFrame.Angles(Rad(-3 + 3 * Cos(sine / 60)), Rad(0), Rad(0)), 0.3)
  266. end
  267. if attack == false and crouch == true then
  268. hum.HipHeight = hh - 0.31
  269. clerp(rootj, rootjnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(45), Rad(0), Rad(0)), 1)
  270. clerp(neck, necknor * CFrame.new(0, 0, 0) * CFrame.Angles(-math.asin(dir.y) + Rad(-45), 0, -math.asin(dir.x)), 1)
  271. clerp(RH, RHnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(45)), 0.3)
  272. clerp(LH, LHnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(-45)), 0.3)
  273. clerp(RS, RSnor * CFrame.new(0, -0.015 + 0.015 * Cos(sine / 60), 0) * CFrame.Angles(Rad(-3 + 3 * Cos(sine / 60)), Rad(0), Rad(0)), 0.3)
  274. clerp(LS, LSnor * CFrame.new(0, -0.015 + 0.015 * Cos(sine / 60), 0) * CFrame.Angles(Rad(-3 + 3 * Cos(sine / 60)), Rad(0), Rad(0)), 0.3)
  275. end
  276. elseif TORSOVELOCITY > 1 then
  277. anim = "Walk"
  278. if attack == false and crouch == false then
  279. hum.HipHeight = hh
  280. clerp(rootj, rootjnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), 1)
  281. clerp(neck, necknor * CFrame.new(0, 0, 0) * CFrame.Angles(-math.asin(dir.y), 0, -math.asin(dir.x)), 1)
  282. clerp(RH, RHnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(55 * Cos(sine / WALKSPEEDVALUE))), 0.3)
  283. clerp(LH, LHnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(55 * Cos(sine / WALKSPEEDVALUE))), 0.3)
  284. clerp(RS, RSnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(-55 * Cos(sine / WALKSPEEDVALUE))), 0.3)
  285. clerp(LS, LSnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(-55 * Cos(sine / WALKSPEEDVALUE))), 0.3)
  286. end
  287. if attack == false and crouch == true then
  288. hum.HipHeight = hh - 0.31
  289. clerp(rootj, rootjnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(45), Rad(0), Rad(0)), 1)
  290. clerp(neck, necknor * CFrame.new(0, 0, 0) * CFrame.Angles(-math.asin(dir.y) + Rad(-45), 0, -math.asin(dir.x)), 1)
  291. clerp(RH, RHnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(45) + Rad(35 * Cos(sine / WALKSPEEDVALUE))), 0.3)
  292. clerp(LH, LHnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(-45) + Rad(35 * Cos(sine / WALKSPEEDVALUE))), 0.3)
  293. clerp(RS, RSnor * CFrame.new(0, -0.015 + 0.015 * Cos(sine / 60), 0) * CFrame.Angles(Rad(-3 + 3 * Cos(sine / 60)), Rad(0), Rad(-35 * Cos(sine / WALKSPEEDVALUE))), 0.3)
  294. clerp(LS, LSnor * CFrame.new(0, -0.015 + 0.015 * Cos(sine / 60), 0) * CFrame.Angles(Rad(-3 + 3 * Cos(sine / 60)), Rad(0), Rad(-35 * Cos(sine / WALKSPEEDVALUE))), 0.3)
  295. end
  296. end
  297. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement