Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game.Players.LocalPlayer.Character:BreakJoints()
- game.Players.LocalPlayer.Character=nil
- Connection = game.Workspace.DescendantAdded:Connect(function(c)
- if c.Name == "Animate" then
- c.Disabled=true
- end
- end)
- repeat wait() until game.Players.LocalPlayer.Character
- Char = game.Players.LocalPlayer.Character
- Died = game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Died:Connect(function()
- Connection:Disconnect()
- Died:Disconnect()
- end)
- wait(.1)
- function waitForChild(parent, childName)
- local child = parent:findFirstChild(childName)
- if child then return child end
- while true do
- child = parent.ChildAdded:wait()
- if child.Name==childName then return child end
- end
- end
- -- ANIMATION
- -- declarations
- local decal = Instance.new("Decal", game.Players.LocalPlayer.Character)
- for i,v in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
- if v.ClassName == "Part" then
- if v.Name == "Head" then
- local torsotec = Instance.new("Decal", torso)
- torsotec.Texture = "http://www.roblox.com/asset/?id=782560028"
- local headd = Instance.new("Decal", v)
- headd.Texture = "http://www.roblox.com/asset/?id=20676546"
- else
- v.Transparency = 1
- end
- end
- if v.ClassName == "Accessory" or v.ClassName == "Hat" then
- v:destroy()
- end
- end
- if game.Players.LocalPlayer.Character.Head:findFirstChild("face") then
- game.Players.LocalPlayer.Character.Head["face"]:destroy()
- end
- rhand = Instance.new("Part", game.Players.LocalPlayer.Character)
- rhand.Size = game.Players.LocalPlayer.Character["Right Arm"].Size
- rhand.TopSurface = "Smooth"
- rhand.BottomSurface = "Smooth"
- rhand.Parent = game.Players.LocalPlayer.Character
- rhand:BreakJoints()
- rhand.CanCollide = false
- rhweld = Instance.new("Weld", rhand)
- rhweld.Part0 = game.Players.LocalPlayer.Character["Right Arm"]
- rhweld.Part1 = rhand
- --
- lhand = Instance.new("Part", game.Players.LocalPlayer.Character)
- lhand.Size = game.Players.LocalPlayer.Character["Left Arm"].Size
- lhand.TopSurface = "Smooth"
- lhand.BottomSurface = "Smooth"
- lhand.CanCollide = false
- lhand.Parent = game.Players.LocalPlayer.Character
- lhand:BreakJoints()
- rhweld1 = Instance.new("Weld", lhand)
- rhweld1.Part0 = game.Players.LocalPlayer.Character["Left Arm"]
- rhweld1.Part1 = lhand
- --
- lleg = Instance.new("Part", game.Players.LocalPlayer.Character)
- lleg.Size = game.Players.LocalPlayer.Character["Left Leg"].Size
- lleg.TopSurface = "Smooth"
- lleg.CanCollide = false
- lleg.BottomSurface = "Smooth"
- lleg.Parent = game.Players.LocalPlayer.Character
- lleg:BreakJoints()
- rhweld11 = Instance.new("Weld", lleg)
- rhweld11.Part0 = game.Players.LocalPlayer.Character["Left Leg"]
- rhweld11.Part1 = lleg
- --
- rleg = Instance.new("Part", game.Players.LocalPlayer.Character)
- rleg.Size = game.Players.LocalPlayer.Character["Right Leg"].Size
- rleg.TopSurface = "Smooth"
- rleg.BottomSurface = "Smooth"
- rleg.Parent = game.Players.LocalPlayer.Character
- rleg.CanCollide = false
- rleg:BreakJoints()
- rhweld111 = Instance.new("Weld", rleg)
- rhweld111.Part0 = game.Players.LocalPlayer.Character["Right Leg"]
- rhweld111.Part1 = rleg
- --
- torso = Instance.new("Part", game.Players.LocalPlayer.Character)
- torso.Size = game.Players.LocalPlayer.Character.Torso.Size
- torso.TopSurface = "Smooth"
- torso.BottomSurface = "Smooth"
- torso.CanCollide = false
- torso.Parent = game.Players.LocalPlayer.Character
- torso:BreakJoints()
- rhweld1111 = Instance.new("Weld", torso)
- rhweld1111.Part0 = game.Players.LocalPlayer.Character.Torso
- rhweld1111.Part1 = torso
- rhand.Color = game.Players.LocalPlayer.Character["Right Arm"].Color
- lhand.Color = game.Players.LocalPlayer.Character["Left Arm"].Color
- rleg.Color = game.Players.LocalPlayer.Character["Right Leg"].Color
- torso.Color = game.Players.LocalPlayer.Character.Torso.Color
- lleg.Color = game.Players.LocalPlayer.Character["Left Leg"].Color
- decal = Instance.new("Decal", torso)
- decal.Texture = "http://www.roblox.com/asset/?id=782560028"
- nostalgie = Instance.new("Sound", game.Players.LocalPlayer.Character)
- nostalgie.SoundId = "rbxassetid://1000016620"
- nostalgie.Looped = true
- nostalgie:Play()
- nostalgie.Volume = 10
- canuse = true
- local shouldertec = Instance.new("Decal", lhand)
- shouldertec.Texture = "http://www.roblox.com/asset/?id=77986517"
- shouldertec.Face = "Top"
- local shouldertec1 = Instance.new("Decal", rhand)
- shouldertec1.Texture = "http://www.roblox.com/asset/?id=77986517"
- shouldertec1.Face = "Top"
- local shouldertec11 = Instance.new("Decal", rhand)
- shouldertec11.Texture = "http://www.roblox.com/asset/?id=178274539"
- shouldertec11.Face = "Bottom"
- local shouldertec111 = Instance.new("Decal", lhand)
- shouldertec111.Texture = "http://www.roblox.com/asset/?id=178274539"
- shouldertec111.Face = "Bottom"
- local legtec = Instance.new("Decal", lleg)
- legtec.Texture = "http://www.roblox.com/asset/?id=178274539"
- legtec.Face = "Bottom"
- local legtec1 = Instance.new("Decal", rleg)
- legtec1.Texture = "http://www.roblox.com/asset/?id=178274539"
- legtec1.Face = "Bottom"
- local Figure = game.Players.LocalPlayer.Character
- local Torso = waitForChild(Figure, "Torso")
- local RightShoulder = waitForChild(Torso, "Right Shoulder")
- local LeftShoulder = waitForChild(Torso, "Left Shoulder")
- local RightHip = waitForChild(Torso, "Right Hip")
- local LeftHip = waitForChild(Torso, "Left Hip")
- local Neck = waitForChild(Torso, "Neck")
- local Humanoid = waitForChild(Figure, "Humanoid")
- local pose = "Standing"
- local toolAnim = "None"
- local toolAnimTime = 0
- local jumpMaxLimbVelocity = 0.75
- -- functions
- function onRunning(speed)
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- pose = "Jumping"
- end
- function onClimbing()
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- pose = "FreeFall"
- end
- function onFallingDown()
- pose = "FallingDown"
- end
- function onSeated()
- pose = "Seated"
- end
- function onPlatformStanding()
- pose = "PlatformStanding"
- end
- function onSwimming(speed)
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function moveJump()
- RightShoulder.MaxVelocity = jumpMaxLimbVelocity
- LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
- RightShoulder:SetDesiredAngle(3.14)
- LeftShoulder:SetDesiredAngle(-3.14)
- RightHip:SetDesiredAngle(0)
- LeftHip:SetDesiredAngle(0)
- end
- -- same as jump for now
- function moveFreeFall()
- RightShoulder.MaxVelocity = jumpMaxLimbVelocity
- LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
- RightShoulder:SetDesiredAngle(3.14)
- LeftShoulder:SetDesiredAngle(-3.14)
- RightHip:SetDesiredAngle(0)
- LeftHip:SetDesiredAngle(0)
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder:SetDesiredAngle(3.14 /2)
- LeftShoulder:SetDesiredAngle(-3.14 /2)
- RightHip:SetDesiredAngle(3.14 /2)
- LeftHip:SetDesiredAngle(-3.14 /2)
- end
- function getTool()
- for _, kid in ipairs(Figure:GetChildren()) do
- if kid.className == "Tool" then return kid end
- end
- return nil
- end
- function getToolAnim(tool)
- for _, c in ipairs(tool:GetChildren()) do
- if c.Name == "toolanim" and c.className == "StringValue" then
- return c
- end
- end
- return nil
- end
- function animateTool()
- if (toolAnim == "None") then
- RightShoulder:SetDesiredAngle(1.57)
- return
- end
- if (toolAnim == "Slash") then
- RightShoulder.MaxVelocity = 0.5
- RightShoulder:SetDesiredAngle(0)
- return
- end
- if (toolAnim == "Lunge") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder:SetDesiredAngle(1.57)
- LeftShoulder:SetDesiredAngle(1.0)
- RightHip:SetDesiredAngle(1.57)
- LeftHip:SetDesiredAngle(1.0)
- return
- end
- end
- function move(time)
- local amplitude
- local frequency
- if (pose == "Jumping") then
- moveJump()
- return
- end
- if (pose == "FreeFall") then
- moveFreeFall()
- return
- end
- if (pose == "Seated") then
- moveSit()
- return
- end
- local climbFudge = 0
- if (pose == "Running") then
- if (RightShoulder.CurrentAngle > 1.5 or RightShoulder.CurrentAngle < -1.5) then
- RightShoulder.MaxVelocity = jumpMaxLimbVelocity
- else
- RightShoulder.MaxVelocity = 0.15
- end
- if (LeftShoulder.CurrentAngle > 1.5 or LeftShoulder.CurrentAngle < -1.5) then
- LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
- else
- LeftShoulder.MaxVelocity = 0.15
- end
- amplitude = 1
- frequency = 9
- elseif (pose == "Climbing") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- amplitude = 1
- frequency = 9
- climbFudge = 3.14
- else
- amplitude = 0.1
- frequency = 1
- end
- desiredAngle = amplitude * math.sin(time*frequency)
- RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
- LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
- RightHip:SetDesiredAngle(-desiredAngle)
- LeftHip:SetDesiredAngle(-desiredAngle)
- local tool = getTool()
- if tool then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject then
- toolAnim = animStringValueObject.Value
- -- message recieved, delete StringValue
- animStringValueObject.Parent = nil
- toolAnimTime = time + .3
- end
- if time > toolAnimTime then
- toolAnimTime = 0
- toolAnim = "None"
- end
- animateTool()
- else
- toolAnim = "None"
- toolAnimTime = 0
- end
- end
- -- connect events
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(onJumping)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.GettingUp:connect(onGettingUp)
- Humanoid.FreeFalling:connect(onFreeFall)
- Humanoid.FallingDown:connect(onFallingDown)
- Humanoid.Seated:connect(onSeated)
- Humanoid.PlatformStanding:connect(onPlatformStanding)
- Humanoid.Swimming:connect(onSwimming)
- -- main program
- local runService = game:service("RunService");
- while Figure.Parent~=nil do
- local _, time = wait(0.1)
- move(time)
- end
Add Comment
Please, Sign In to add comment