Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr=game.Players.LocalPlayer
- local char=plr.Character
- local mouse=plr:GetMouse()
- local run=false
- local speed=0.1
- local snaptime=0.5
- local length=15
- local walking=false
- local Character=char
- local idle=true
- local Torso = char:WaitForChild("Torso")
- local RootPart=char:WaitForChild("HumanoidRootPart")
- local LArm = char:WaitForChild("Left Arm")
- local RArm = char:WaitForChild("Right Arm")
- local LLeg = char:WaitForChild("Left Leg")
- local RLeg = char:WaitForChild("Right Leg")
- local Head = char:WaitForChild("Head")
- local LAWeld = Instance.new("Weld",LArm)
- LAWeld.Part0 = LArm
- LAWeld.Part1 = Torso
- LAWeld.C0 = CFrame.new(1.5,0,0)
- local DefaultLA=CFrame.new(1.5,0,0)
- local RAWeld = Instance.new("Weld",RArm)
- RAWeld.Part0 = RArm
- RAWeld.Part1 = Torso
- RAWeld.C0 = CFrame.new(-1.5,0,0)
- local DefaultRA=CFrame.new(-1.5,0,0)
- local LLWeld = Instance.new("Weld",LLeg)
- LLWeld.Part0 = LLeg
- LLWeld.Part1 = Torso
- LLWeld.C0 = CFrame.new(.5,2,0)
- local DefaultLL=CFrame.new(.5,2,0)
- local RLWeld = Instance.new("Weld",RLeg)
- RLWeld.Part0 = RLeg
- RLWeld.Part1 = Torso
- RLWeld.C0 =CFrame.new(-.5,2,0)
- local DefaultRL=CFrame.new(-.5,2,0)
- local NWeld = Instance.new("Weld",Head)
- NWeld.Part0 = Head
- NWeld.Part1 = Torso
- NWeld.C0 = CFrame.new(0,-1.5,0)
- local DefaultN=CFrame.new(0,-1.5,0)
- local TWeld = Instance.new("Weld",Torso)
- TWeld.Part0 = Torso
- TWeld.Part1 = RootPart
- TWeld.C0 = CFrame.new(0,0,0)
- local DefaultT=CFrame.new(0,0,0)
- local LeftHip=char.Torso:WaitForChild("Left Hip")
- local LeftShoulder=char.Torso:WaitForChild("Left Shoulder")
- local RightHip=char.Torso:WaitForChild("Right Hip")
- local RightShoulder=char.Torso:WaitForChild("Right Shoulder")
- local Neck=char.Torso:WaitForChild("Neck")
- local RootJoin=RootPart:WaitForChild("RootJoint")
- local limbs={LLeg,LArm,RLeg,RArm,Torso}
- local OrigWelds={LeftHip,LeftShoulder,RightHip,RightShoulder,RootJoin}
- local LeftHipc=LeftHip:clone()
- local LeftShoulderc=LeftShoulder:clone()
- local RightHipc=RightHip:clone()
- local RightShoulderc=RightShoulder:clone()
- local RootJoinc=RootPart:WaitForChild("RootJoint"):clone()
- local Neckc=Neck:clone()
- local clones={LeftHipc,LeftShoulderc,RightHipc,RightShoulderc,RootJoinc}
- function Deactivate()
- for i,v in pairs(OrigWelds) do
- v:Destroy()
- end
- end
- Deactivate()
- function Activate()
- for i,v in pairs(clones) do
- if v.Name~="RootJoint" then
- v.Parent=char.Torso
- v.Part1=limbs[i]
- else
- v.Parent=RootPart
- v.Part1=Torso
- end
- end
- end
- local LAAI={CFrame.new(1.47054291, 0.295805931, 0, 0.980362475, -0.197203964, 0, 0.197203964, 0.980362475, 0, 0, 0, 1),
- CFrame.new(1.58911896, 0.455195427, 0, 0.942918897, -0.333022594, 0, 0.333022594, 0.942918897, 0, 0, 0, 1) }
- local LLAI={CFrame.new(0.366447449, 2.05275655, 0, 0.993932962, -0.109987587, 0, 0.109987579, 0.993932962, 0, 0, 0, 1) }
- local RAAI={CFrame.new(-1.50102997, 0.301249504, 0.0222530365, 0.966990292, 0.254323632, 0.015791649, -0.254436553, 0.967073381, 0.00557740033, -0.0138532184, -0.00941126421, 0.99985975),
- CFrame.new(-1.61062241, 0.577659607, 0.0222816467, 0.921636164, 0.38770771, 0.0164184049, -0.387807906, 0.921734393, 0.003302817, -0.0138528794, -0.00941118132, 0.99985975)}
- RLAI={CFrame.new(-0.442806244, 2.05268383, 0, 0.995276213, 0.0970840752, 0, -0.0970840752, 0.995276213, 0, 0, 0, 1) }
- local NLAI={CFrame.new(0, -1.49245977, -0.158288956, 1, 0, 0, 0, 0.99035722, -0.13853769, 0, 0.13853769, 0.99035722),
- CFrame.new(0, -1.46035576, -0.346199036, 1, 0, 0, 0, 0.964806914, -0.262959272, 0, 0.262959272, 0.964806914) }
- local TAI={CFrame.new(0,-10-math.cos(tick()),0)}
- IdleAnims={LAAI,LLAI,RAAI,RLAI,NLAI,TAI}
- welds={LAWeld,LLWeld,RAWeld,RLWeld,NWeld,TWeld}
- Defaults={LAAI[1],LLAI[1],RAAI[1],RLAI[1],NLAI[1],TAI[1]}
- OrigDefaults={DefaultLA,DefaultLL,DefaultRA,DefaultRL,DefaultN,DefaultT}
- local LAT=nil
- local LLT=nil
- local RAT=nil
- local RLT=nil
- local TT=nil
- local NT=nil
- local LATI=nil
- local LLTI=nil
- local RATI=nil
- local RLTI=nil
- local TTI=nil
- local NTI=nil
- PosWalk={LAT,LLT,RAT,RLT,NT,TT}
- PosIdle={LATI,LLTI,RATI,RLTI,NTI,TTI}
- local LAA={CFrame.new(1.25498962, 1.55565453, -0.0322542191, 0.976632535, 0.214844614, 0.00554542337, 0.21491617, -0.976307333, -0.0252000056, -4.80024411e-008, 0.0258029457, -0.999667048)}
- local LLA={CFrame.new(0.279708862, 2.12116861, 0, 0.973199666, -0.22996217, 0, 0.22996217, 0.973199666, 0, 0, 0, 1)}
- local RAA={CFrame.new(-1.27351761, 1.68028164, 0.020203352, 0.966919124, -0.255052239, 0.00396421505, -0.255083054, -0.966802418, 0.0150269, -3.18337925e-008, -0.0155410012, -0.999879241)}
- local RLA={CFrame.new(-0.359859467, 2.15520191, 0, 0.969144285, 0.246494561, 0, -0.246494561, 0.969144285, 0, 0, 0, 1)}
- local NLA={CFrame.new(0, -0.831441164, 1.24848127, 1, 0, 0, 0, 0.554294109, 0.832320929, 0, -0.832320929, 0.554294109)}
- local TA={
- CFrame.new(0, 0, -3.28998947, 1, 0, 0, 0, 0, -1, 0, 1, 0)}
- WalkAnims={LAA,LLA,RAA,RLA,NLA,TA}
- spawn(function()
- while true do
- wait(2)
- for i,v in ipairs(IdleAnims) do
- spawn(function()
- for b,z in pairs(v) do
- PosIdle[i]=z
- wait(1)
- end
- end)
- end
- end
- end)
- spawn(function()
- while true do
- wait(snaptime*#RLA)
- for i,v in ipairs(WalkAnims) do
- spawn(function()
- for b,z in pairs(v) do
- PosWalk[i]=z
- wait(snaptime)
- end
- end)
- end
- end
- end)
- repeat wait(1) until PosIdle[1]~=nil or PosWalk[1]~=nil
- print("Ready")
- --check if walking
- game:GetService("RunService").RenderStepped:connect(function()
- if char.Torso.Velocity.Magnitude>=10 then
- print("Moving")
- walking=true
- for i,v in pairs(welds) do
- if v==TWeld then
- v.C0=v.C0:lerp(PosWalk[i]*CFrame.new(math.sin(tick()),math.sin(tick()),0),0.1)
- end
- v.C0=v.C0:lerp(PosWalk[i],0.1)
- end
- elseif char.Torso.Velocity.Magnitude<=30 then
- walking=false
- for i,v in pairs(welds) do
- if v==TWeld then
- v.C0=v.C0:lerp(CFrame.new(0,-5-math.cos(tick()),0),0.05)
- end
- v.C0=v.C0:lerp(PosIdle[i],0.01)
- end
- end
- end)
- --walk func
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement