Prephy

funi test

May 6th, 2021 (edited)
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.98 KB | None | 0 0
  1. --literally garbage
  2.  
  3. function anima()
  4.  
  5.     NLS([[
  6.  
  7. local Humanoid =  Instance.new('Humanoid',owner.Character) Humanoid.BreakJointsOnDeath=false Humanoid.RequiresNeck=false
  8.  
  9. function waitForChild(parent, childName)
  10.     while true do
  11.         local child = parent:findFirstChild(childName)
  12.         if child then
  13.             return child
  14.         end
  15.         parent.ChildAdded:wait()
  16.     end
  17. end
  18.  
  19. -- declarations
  20.  
  21. local Figure = owner.Character
  22. local Torso = waitForChild(Figure, "Torso")
  23. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  24. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  25. local RightHip = waitForChild(Torso, "Right Hip")
  26. local LeftHip = waitForChild(Torso, "Left Hip")
  27. local Neck = waitForChild(Torso, "Neck")
  28. Humanoid:ClearAllChildren()
  29. workspace.CurrentCamera.CameraSubject=Humanoid
  30. Torso.CanCollide=false
  31.  
  32.  
  33.  
  34. local Head = waitForChild(Figure, "Head")
  35.  
  36. -- functions
  37.  
  38.  
  39.  
  40. local toolAnim = "None"
  41. local toolAnimTime = 0
  42.  
  43. -- functions
  44.  
  45. function onRunning(speed)
  46.     if speed>0 then
  47.         pose = "Running"
  48.     else
  49.         pose = "Standing"
  50.     end
  51. end
  52.  
  53. function onDied()
  54.     pose = "Dead"
  55. end
  56.  
  57. function onJumping(state)
  58.     pose = "Jumping"
  59. end
  60.  
  61. function onClimbing()
  62.     pose = "Climbing"
  63. end
  64.  
  65. function onGettingUp(state)
  66.     pose = "GettingUp"
  67. end
  68.  
  69. function onFreeFall(state)
  70.     pose = "FreeFall"
  71. end
  72.  
  73. function onFallingDown(state)
  74.     pose = "FallingDown"
  75. end
  76.  
  77. function onSeated()
  78.     pose = "Seated"
  79. end
  80.  
  81. function moveJump()
  82.     RightShoulder.MaxVelocity = 0.5
  83.     LeftShoulder.MaxVelocity = 0.5
  84.     RightShoulder.DesiredAngle = 3.14
  85.     LeftShoulder.DesiredAngle = -3.14
  86.     RightHip.DesiredAngle = 0
  87.     LeftHip.DesiredAngle = 0
  88. end
  89.  
  90.  
  91. -- same as jump for now
  92.  
  93. function moveFreeFall()
  94.     RightShoulder.MaxVelocity = 0.5
  95.     LeftShoulder.MaxVelocity = 0.5
  96.     RightShoulder.DesiredAngle = 3.14
  97.     LeftShoulder.DesiredAngle = -3.14
  98.     RightHip.DesiredAngle = 0
  99.     LeftHip.DesiredAngle = 0
  100. end
  101.  
  102. function moveSit()
  103.     RightShoulder.MaxVelocity = 0.15
  104.     LeftShoulder.MaxVelocity = 0.15
  105.     RightShoulder.DesiredAngle = 3.14 /2
  106.     LeftShoulder.DesiredAngle = -3.14 /2
  107.     RightHip.DesiredAngle = 3.14 /2
  108.     LeftHip.DesiredAngle = -3.14 /2
  109. end
  110.  
  111. local function getTool()
  112.     for i, v in ipairs(Figure:GetChildren()) do
  113.         if v:IsA"Tool" then
  114.             return v
  115.         end
  116.     end
  117.     return nil
  118. end
  119.  
  120. function getToolAnim(tool)
  121.     for _, c in ipairs(tool:GetChildren()) do
  122.         if c.Name == "toolanim" and c.className == "StringValue" then
  123.             return c
  124.         end
  125.     end
  126.     return nil
  127. end
  128.  
  129. function animateTool()
  130.    
  131.     if (toolAnim == "None") then
  132.         RightShoulder.DesiredAngle = 1.57
  133.         return
  134.     end
  135.  
  136.     if (toolAnim == "Slash") then
  137.         RightShoulder.MaxVelocity = 0.5
  138.         RightShoulder.DesiredAngle = 0
  139.         return
  140.     end
  141.  
  142.     if (toolAnim == "Lunge") then
  143.         RightShoulder.MaxVelocity = 0.5
  144.         LeftShoulder.MaxVelocity = 0.5
  145.         RightHip.MaxVelocity = 0.5
  146.         LeftHip.MaxVelocity = 0.5
  147.         RightShoulder.DesiredAngle = 1.57
  148.         LeftShoulder.DesiredAngle = 1.0
  149.         RightHip.DesiredAngle = 1.57
  150.         LeftHip.DesiredAngle = 1.0
  151.         return
  152.     end
  153. end
  154.  
  155. function move(time)
  156.     local amplitude
  157.     local frequency
  158.  
  159.     if (pose == "Jumping") then
  160.         moveJump()
  161.         return
  162.     end
  163.  
  164.     if (pose == "FreeFall") then
  165.         moveFreeFall()
  166.         return
  167.     end
  168.  
  169.     if (pose == "Seated") then
  170.         moveSit()
  171.         return
  172.     end
  173.  
  174.     local climbFudge = 0
  175.    
  176.     if (pose == "Running") then
  177.         RightShoulder.MaxVelocity = 0.15
  178.         LeftShoulder.MaxVelocity = 0.15
  179.         amplitude = 1
  180.         frequency = 9
  181.     elseif (pose == "Climbing") then
  182.         RightShoulder.MaxVelocity = 0.5
  183.         LeftShoulder.MaxVelocity = 0.5
  184.         amplitude = 1
  185.         frequency = 9
  186.         climbFudge = 3.14
  187.     else
  188.         amplitude = 0.1
  189.         frequency = 1
  190.     end
  191.  
  192.     desiredAngle = amplitude * math.sin(time*frequency)
  193.  
  194.     RightShoulder.DesiredAngle = desiredAngle + climbFudge
  195.     LeftShoulder.DesiredAngle = desiredAngle - climbFudge
  196.     RightHip.DesiredAngle = -desiredAngle
  197.     LeftHip.DesiredAngle = -desiredAngle
  198.  
  199.  
  200.     local tool = getTool()
  201.  
  202.     if tool then
  203.    
  204.         animStringValueObject = getToolAnim(tool)
  205.  
  206.         if animStringValueObject then
  207.             toolAnim = animStringValueObject.Value
  208.             -- message recieved, delete StringValue
  209.             animStringValueObject.Parent = nil
  210.             toolAnimTime = time + .3
  211.         end
  212.  
  213.         if time > toolAnimTime then
  214.             toolAnimTime = 0
  215.             toolAnim = "None"
  216.         end
  217.  
  218.         animateTool()
  219.  
  220.        
  221.     else
  222.         toolAnim = "None"
  223.         toolAnimTime = 0
  224.     end
  225. end
  226.  
  227.  
  228. -- connect events
  229.  
  230. Humanoid.Died:connect(onDied)
  231. Humanoid.Running:connect(onRunning)
  232. Humanoid.Jumping:connect(onJumping)
  233. Humanoid.Climbing:connect(onClimbing)
  234. Humanoid.GettingUp:connect(onGettingUp)
  235. Humanoid.FreeFalling:connect(onFreeFall)
  236. Humanoid.FallingDown:connect(onFallingDown)
  237. Humanoid.Seated:connect(onSeated)
  238.  
  239.  
  240.  
  241. -- main program
  242.  
  243. local runService = game:service("RunService");
  244. while Figure.Parent~=nil do
  245.     local _, time = wait(0.1)
  246.     move(time)
  247. end
  248.  
  249.  
  250.  
  251.  
  252.  
  253. ]],owner.Backpack)
  254.  
  255.     owner:ClearCharacterAppearance()
  256.     local forc = Instance.new('ForceField',owner.Character) forc.Visible=false
  257. end
  258.  
  259. function waitForChild(parent, childName)
  260.     local child = parent:findFirstChild(childName)
  261.     if child then return child end
  262.     while true do
  263.         child = parent.ChildAdded:wait()
  264.         if child.Name==childName then return child end
  265.     end
  266. end
  267.  
  268.  
  269. local Figure = owner.Character
  270. local hu = Figure:FindFirstChildOfClass('Humanoid')
  271. if hu then
  272.     hu:Destroy()
  273. end
  274. local an = Figure:FindFirstChild('Animate')
  275. if an then
  276.     an.Disabled=true
  277. end
  278. local Torso = waitForChild(Figure, "Torso")
  279. Torso.BrickColor=BrickColor.new("Bright blue")
  280. t = Instance.new("Texture")
  281. t.Parent = Torso
  282. t.StudsPerTileU = 2
  283. t.StudsPerTileV = 4
  284. t.Texture = "http://www.roblox.com/asset/?id=41198057"
  285. t.Face = "Top"
  286. t.Name = "TopStud"
  287. tb = Instance.new("Texture")
  288. tb.Parent = Torso
  289. tb.StudsPerTileV = 4
  290. tb.StudsPerTileU = 2
  291. tb.Texture = "http://www.roblox.com/asset/?id=41198044"
  292. tb.Face = "Bottom"
  293. tb.Name = "BottomStud"
  294. Torso.TopSurface = "Smooth"
  295. Torso.BottomSurface = "Smooth"
  296. function makeJoint(limbName, jointName, c0, c1)
  297.     local limb = waitForChild(Figure, limbName)
  298.    
  299.     if limb.Name=='Head' then
  300.         local gm    =limb:FindFirstChildOfClass('SpecialMesh')
  301.         if gm then
  302.             gm:Destroy()
  303.         end
  304.         local mesh = Instance.new("SpecialMesh",limb)
  305.         mesh.MeshId='rbxassetid://1104623876'
  306.         mesh.Scale=Vector3.new(1.25,1.25,1.25)
  307.         local face = limb:FindFirstChildOfClass('Decal')
  308.         if face then
  309.             face.Texture='rbxassetid://1104210678'
  310.         end
  311.         limb.BrickColor=BrickColor.new('Bright yellow')
  312.     else
  313.         if limb.Name=='Right Leg'  then
  314.             limb:BreakJoints()
  315.             limb.BrickColor=BrickColor.new("Br. yellowish green")
  316.         end
  317.        
  318.         if limb.Name=='Left Leg'  then
  319.             limb:BreakJoints()
  320.             limb.BrickColor=BrickColor.new("Br. yellowish green")
  321.         end
  322.        
  323.         if limb.Name=='Left Arm'  then
  324.             limb:BreakJoints()
  325.             limb.BrickColor=BrickColor.new("Bright yellow")
  326.         end
  327.        
  328.         if limb.Name=='Right Arm'  then
  329.             limb:BreakJoints()
  330.             limb.BrickColor=BrickColor.new("Bright yellow")
  331.         end
  332.        
  333.         limb.Material=Enum.Material.SmoothPlastic
  334.        
  335.        
  336.         t = Instance.new("Texture")
  337.         t.Parent = limb
  338.         t.StudsPerTileU = 2
  339.         t.StudsPerTileV = 4
  340.         t.Texture = "http://www.roblox.com/asset/?id=41198057"
  341.         t.Face = "Top"
  342.         t.Name = "TopStud"
  343.         tb = Instance.new("Texture")
  344.         tb.Parent = limb
  345.         tb.StudsPerTileV = 4
  346.         tb.StudsPerTileU = 2
  347.         tb.Texture = "http://www.roblox.com/asset/?id=41198044"
  348.         tb.Face = "Bottom"
  349.         tb.Name = "BottomStud"
  350.         limb.TopSurface = "Smooth"
  351.      limb.BottomSurface = "Smooth"
  352.        
  353.     end
  354.     local joint = Instance.new"Motor6D"
  355.     joint.Name = jointName
  356.     joint.Part0 = Torso
  357.     joint.Part1 = limb
  358.     joint.C0 = c0
  359.     joint.C1 = c1
  360.     joint.MaxVelocity = 0.15
  361.     joint.archivable = false
  362.     joint.Parent = Torso
  363.     return joint
  364. end
  365.  
  366. local Neck = makeJoint("Head","Neck", CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0))
  367. local RightShoulder = makeJoint("Right Arm", "Right Shoulder", CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
  368. local LeftShoulder = makeJoint("Left Arm", "Left Shoulder", CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
  369. local RightHip = makeJoint("Right Leg", "Right Hip", CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
  370. local LeftHip = makeJoint("Left Leg", "Left Hip", CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
  371.  
  372. anima()
  373.  
  374.  
Add Comment
Please, Sign In to add comment