Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --BasicFunctions
- local ins = Instance.new
- local v3 = Vector3.new
- local cf = CFrame.new
- local angles = CFrame.Angles
- local rad = math.rad
- local huge = math.huge
- local cos = math.cos
- local sin = math.sin
- local tan = math.tan
- local ray = Ray.new
- local random = math.random
- local ud = UDim.new
- local ud2 = UDim2.new
- local c3 = Color3.new
- local rgb = Color3.fromRGB
- local bc = BrickColor.new
- --Variables
- local char = owner.Character
- local h = char.Head
- local t = char.Torso
- local ra = char["Right Arm"]
- local la = char["Left Arm"]
- local rl = char["Right Leg"]
- local ll = char["Left Leg"]
- local rut = char.HumanoidRootPart
- local hum = char:FindFirstChildOfClass("Humanoid")
- local necno = t.Neck
- local rutjno = rut.RootJoint
- local rsno = t["Right Shoulder"]
- local lsno = t["Left Shoulder"]
- local rhno = t["Right Hip"]
- local lhno = t["Left Hip"]
- --
- local change = 1
- local sine = 0
- local animspeed = .1
- local idledevider = 12.5
- local maxlegdist = 1.35
- local rlegdist
- local llegdist
- local sitting = false
- local laying = false
- local slow = true
- local ruined = false
- local holdingtool = false
- local using = false
- local anim = "idle"
- local asset = "rbxassetid://"
- --
- local stepsounds = {
- Grass = asset.."1201103066",
- Sand = asset.."1436385526",
- Plastic = asset.."1569994049",
- Stone = asset.."1201103555", --379398649
- Wood = asset.."1201103959",
- Pebble = asset.."1201103211",
- Ice = asset.."265653271",
- Glass = asset.."145180170",
- Metal = asset.."379482691"
- }
- --
- local necc0 = cf(0, 1, 0)
- local necc1 = cf(0,-.5,0)
- local rsc0 = cf(1, .5, 0)
- local rsc1 = cf(-.5, .5, 0)
- local lsc0 = cf(-1, .5, 0)
- local lsc1 = cf(.5, .5, 0)
- local rhc0 = cf(.5,-1,0)*cf(0,1.2,0)
- local rhc1 = cf(0,1,0)
- local lhc0 = cf(-.5,-1,0)*cf(0,1.2,0)
- local lhc1 = cf(0,1,0)
- local rutjc0 = cf(0,0,0)
- local rutjc1 = cf(0,0,0)
- if char:FindFirstChild("Animate") then
- char.Animate:Destroy()
- end
- if hum:FindFirstChildOfClass("Animator") then
- char.Humanoid.Animator:Destroy()
- end
- if ruined then
- change = 99999999
- idledevider = .01
- animspeed = .95
- end
- --Creating new joints
- local nec = ins("Motor6D",t) nec.Name = "Neck" nec.Part0 = t nec.Part1 = h
- local rutj = ins("Motor6D",rut) rutj.Name = "RootJoint" rutj.Part0 = t rutj.Part1 = rut
- local rs = ins("Motor6D",t) rs.Name = "Right Shoulder" rs.Part0 = t rs.Part1 = ra
- local ls = ins("Motor6D",t) ls.Name = "Left Shoulder" ls.Part0 = t ls.Part1 = la
- local rh = ins("Motor6D",t) rh.Name = "Right Hip" rh.Part0 = t rh.Part1 = rl
- local lh = ins("Motor6D",t) lh.Name = "Left Hip" lh.Part0 = t lh.Part1 = ll
- --Removing old joints
- necno.Parent = nil
- rutjno.Parent = nil
- rsno.Parent = nil
- lsno.Parent = nil
- rhno.Parent = nil
- lhno.Parent = nil
- --Setting CFrames
- nec.C1 = necc1
- nec.C0 = necc0
- rs.C1 = rsc1
- rs.C0 = rsc0
- ls.C1 = lsc1
- ls.C0 = lsc0
- rh.C1 = rhc1
- rh.C0 = rhc0*cf(0,-1,0)
- lh.C1 = lhc1
- lh.C0 = lhc0*cf(0,-1,0)
- rutj.C1 = rutjc1
- rutj.C0 = rutjc0
- --Some creates
- --Models
- --Parts
- --Welds
- --Sounds
- local footstepsound = ins("Sound",t)
- footstepsound.Volume = 2
- footstepsound.SoundId = stepsounds.Grass
- --Connecting sprint
- local rem = ins("RemoteEvent",char) rem.Name = "SprintEvent"
- local client = NLS([[
- local rem = owner.Character:WaitForChild("SprintEvent")
- game:GetService("Players").LocalPlayer:GetMouse().KeyDown:Connect(function(key)
- if string.byte(key) == 50 then
- rem:FireServer("speed",false)
- end
- if key == "x" then
- rem:FireServer("sit")
- end
- if key == "c" then
- rem:FireServer("lay")
- end
- end)
- game:GetService("Players").LocalPlayer:GetMouse().KeyUp:Connect(function(key)
- if string.byte(key) == 50 then
- rem:FireServer("speed",true)
- end
- end)
- ]],owner.Character)
- rem.OnServerEvent:Connect(function(plr,type,value)
- if type == "speed" then
- slow = value
- elseif type == "sit" then
- if not sitting then
- sit()
- else
- unsit()
- end
- elseif type == "lay" then
- if not laying then
- lay()
- else
- unlay()
- end
- end
- end)
- function swait()
- game:GetService("RunService").Stepped:Wait()
- end
- function rayc(spos,direc,ignore,dist)
- local rai = ray(spos,direc.Unit * dist)
- local rhit,rpos,rrot = workspace:FindPartOnRayWithIgnoreList(rai,ignore,false,false)
- return rhit,rpos,rrot
- end
- function getdistfrowtorsotowall()
- local ruthit,rutpos,rutrot = rayc(t.Position,t.CFrame.RightVector,{char},2)
- local dist1 = (t.Position-rutpos).Magnitude-2
- local luthit,lutpos,lutrot = rayc(t.Position,-t.CFrame.RightVector,{char},2)
- local dist2 = (t.Position-lutpos).Magnitude-2
- return dist1,dist2
- end
- function sit()
- if not using then
- sitting = true
- using = true
- anim = "idle"
- if not laying then
- for i = 0,1.5,.025 do
- nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-20),rad(-30),rad(0)),i)
- rs.C0 = rs.C0:Lerp(rsc0*cf(.1,-.5,.1)*angles(rad(-5),rad(-10),rad(20)),i)
- ls.C0 = ls.C0:Lerp(lsc0*cf(0,0,0)*angles(rad(10),rad(0),rad(20)),i)
- rh.C0 = rh.C0:Lerp(rhc0*cf(0,.25,-.3)*angles(rad(0),rad(0),rad(20)),i)
- lh.C0 = lh.C0:Lerp(lhc0*cf(0,-.4,-.5)*angles(rad(0),rad(0),rad(20)),i)
- rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,1.2,0)*angles(rad(10),rad(0),rad(20)),i)
- swait()
- end
- else
- laying = false
- end
- for i = 0,1.5,.025 do
- nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-20),rad(0),rad(0)),i)
- rs.C0 = rs.C0:Lerp(rsc0*cf(0,-.2,.2)*angles(rad(-45),rad(0),rad(0)),i)
- ls.C0 = ls.C0:Lerp(lsc0*cf(0,-.2,.2)*angles(rad(-45),rad(0),rad(0)),i)
- rh.C0 = rh.C0:Lerp(rhc0*cf(0,-1.1,0)*angles(rad(60),rad(0),rad(5)),i)
- lh.C0 = lh.C0:Lerp(lhc0*cf(0,-1.1,0)*angles(rad(60),rad(0),rad(-5)),i)
- rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,1.45,-1)*angles(rad(-30),rad(0),rad(0)),i)
- swait()
- end
- using = false
- end
- end
- function unsit()
- if not using then
- using = true
- for i = 0,1.5,.025 do
- nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-20),rad(-30),rad(0)),i)
- rs.C0 = rs.C0:Lerp(rsc0*cf(.1,-.5,.1)*angles(rad(-5),rad(-10),rad(20)),i)
- ls.C0 = ls.C0:Lerp(lsc0*cf(0,0,0)*angles(rad(10),rad(0),rad(20)),i)
- rh.C0 = rh.C0:Lerp(rhc0*cf(0,.25,-.3)*angles(rad(0),rad(0),rad(20)),i)
- lh.C0 = lh.C0:Lerp(lhc0*cf(0,-.4,-.5)*angles(rad(0),rad(0),rad(20)),i)
- rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,1.2,0)*angles(rad(10),rad(0),rad(20)),i)
- swait()
- end
- sitting = false
- laying = false
- using = false
- end
- end
- function lay()
- if not using then
- laying = true
- using = true
- anim = "idle"
- if not sitting then
- for i = 0,1.5,.025 do
- nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-20),rad(-30),rad(0)),i)
- rs.C0 = rs.C0:Lerp(rsc0*cf(.1,-.5,.1)*angles(rad(-5),rad(-10),rad(20)),i)
- ls.C0 = ls.C0:Lerp(lsc0*cf(0,0,0)*angles(rad(10),rad(0),rad(20)),i)
- rh.C0 = rh.C0:Lerp(rhc0*cf(0,.25,-.3)*angles(rad(0),rad(0),rad(20)),i)
- lh.C0 = lh.C0:Lerp(lhc0*cf(0,-.4,-.5)*angles(rad(0),rad(0),rad(20)),i)
- rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,1.2,0)*angles(rad(10),rad(0),rad(20)),i)
- swait()
- end
- else
- sitting = false
- end
- for i = 0,1.5,.025 do
- nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-25),rad(0),rad(0)),i)
- rs.C0 = rs.C0:Lerp(rsc0*cf(-.3,.25,0)*angles(rad(180),rad(-5),rad(-40)),i)
- ls.C0 = ls.C0:Lerp(lsc0*cf(.3,.25,0)*angles(rad(180),rad(5),rad(40)),i)
- rh.C0 = rh.C0:Lerp(rhc0*cf(0,-1,0)*angles(rad(10),rad(-5),rad(-25)),i)
- lh.C0 = lh.C0:Lerp(lhc0*cf(0,-1,0)*angles(rad(0),rad(0),rad(5)),i)
- rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,0,-2.495)*angles(rad(-90),rad(5),rad(0)),i)
- swait()
- end
- using = false
- end
- end
- function unlay()
- if not using then
- using = true
- for i = 0,1.5,.025 do
- nec.C0 = nec.C0:Lerp(necc0*cf(0,0,0)*angles(rad(-20),rad(-30),rad(0)),i)
- rs.C0 = rs.C0:Lerp(rsc0*cf(.1,-.5,.1)*angles(rad(-5),rad(-10),rad(20)),i)
- ls.C0 = ls.C0:Lerp(lsc0*cf(0,0,0)*angles(rad(10),rad(0),rad(20)),i)
- rh.C0 = rh.C0:Lerp(rhc0*cf(0,.25,-.3)*angles(rad(0),rad(0),rad(20)),i)
- lh.C0 = lh.C0:Lerp(lhc0*cf(0,-.4,-.5)*angles(rad(0),rad(0),rad(20)),i)
- rutj.C0 = rutj.C0:Lerp(rutjc0*cf(0,1.2,0)*angles(rad(10),rad(0),rad(20)),i)
- swait()
- end
- laying = false
- sitting = false
- using = false
- end
- end
- function changesound(hit)
- if not ruined then
- if hit then
- if hit.Material == Enum.Material.Sand then
- footstepsound.SoundId = stepsounds.Sand
- footstepsound.Volume = 1
- elseif hit.Material == Enum.Material.Grass or hit.Material == Enum.Material.Fabric then
- footstepsound.SoundId = stepsounds.Grass
- footstepsound.Volume = 3
- elseif hit.Material == Enum.Material.Granite or hit.Material == Enum.Material.Slate or hit.Material == Enum.Material.Concrete or hit.Material == Enum.Material.Marble or hit.Material == Enum.Material.Brick or hit.Material == Enum.Material.Cobblestone then
- footstepsound.SoundId = stepsounds.Stone
- footstepsound.Volume = 1
- elseif hit.Material == Enum.Material.Plastic or hit.Material == Enum.Material.SmoothPlastic or hit.Material == Enum.Material.Neon then
- footstepsound.SoundId = stepsounds.Plastic
- footstepsound.Volume = 2
- elseif hit.Material == Enum.Material.Wood or hit.Material == Enum.Material.WoodPlanks then
- footstepsound.SoundId = stepsounds.Wood
- footstepsound.Volume = 1
- elseif hit.Material == Enum.Material.Ice then
- footstepsound.SoundId = stepsounds.Ice
- footstepsound.Volume = 4
- elseif hit.Material == Enum.Material.Pebble then
- footstepsound.SoundId = stepsounds.Pebble
- footstepsound.Volume = 1
- elseif hit.Material == Enum.Material.Glass then
- footstepsound.SoundId = stepsounds.Glass
- footstepsound.Volume = 1
- elseif hit.Material == Enum.Material.Metal or hit.Material == Enum.Material.DiamondPlate or hit.Material == Enum.Material.CorrodedMetal then
- footstepsound.SoundId = stepsounds.Metal
- footstepsound.Volume = 1
- end
- end
- else
- if hit then
- if hit.Material == Enum.Material.Sand then
- footstepsound.SoundId = stepsounds.Sand
- footstepsound.Volume = 10
- elseif hit.Material == Enum.Material.Grass or hit.Material == Enum.Material.Fabric then
- footstepsound.SoundId = stepsounds.Grass
- footstepsound.Volume = 10
- elseif hit.Material == Enum.Material.Granite or hit.Material == Enum.Material.Slate or hit.Material == Enum.Material.Concrete or hit.Material == Enum.Material.Marble or hit.Material == Enum.Material.Brick or hit.Material == Enum.Material.Cobblestone then
- footstepsound.SoundId = stepsounds.Stone
- footstepsound.Volume = 10
- elseif hit.Material == Enum.Material.Plastic or hit.Material == Enum.Material.SmoothPlastic or hit.Material == Enum.Material.Neon then
- footstepsound.SoundId = stepsounds.Plastic
- footstepsound.Volume = 10
- elseif hit.Material == Enum.Material.Wood or hit.Material == Enum.Material.WoodPlanks then
- footstepsound.SoundId = stepsounds.Wood
- footstepsound.Volume = 10
- elseif hit.Material == Enum.Material.Ice then
- footstepsound.SoundId = stepsounds.Ice
- footstepsound.Volume = 10
- elseif hit.Material == Enum.Material.Pebble then
- footstepsound.SoundId = stepsounds.Pebble
- footstepsound.Volume = 10
- elseif hit.Material == Enum.Material.Glass then
- footstepsound.SoundId = stepsounds.Glass
- footstepsound.Volume = 10
- elseif hit.Material == Enum.Material.Metal or hit.Material == Enum.Material.DiamondPlate or hit.Material == Enum.Material.CorrodedMetal then
- footstepsound.SoundId = stepsounds.Metal
- footstepsound.Volume = 10
- end
- end
- end
- end
- local anims = coroutine.wrap(function()
- while true do
- if not slow and not sitting and not laying then
- hum.WalkSpeed = 50*(animspeed*10)
- hum.JumpPower = 50
- elseif slow and not sitting and not laying then
- hum.WalkSpeed = 16*(animspeed*10)
- hum.JumpPower = 50
- elseif sitting or laying then
- hum.JumpPower = 0
- hum.WalkSpeed = 0
- end
- if not footstepsound or not footstepsound.Parent then
- footstepsound = ins("Sound",t)
- footstepsound.Volume = 2
- footstepsound.SoundId = stepsounds.Grass
- end
- if char:FindFirstChildOfClass("Tool") then
- holdingtool = true
- else
- holdingtool = false
- end
- local rhit,rpos,rrot = rayc(v3(rl.Position.x,t.Position.y-1.8,rl.Position.z),-rut.CFrame.UpVector,{char},maxlegdist)
- local lhit,lpos,lrot = rayc(v3(ll.Position.x,t.Position.y-1.8,ll.Position.z),-rut.CFrame.UpVector,{char},maxlegdist)
- rlegdist = (v3(rl.Position.x,rut.Position.y-1.8,rl.Position.z)-rpos).Magnitude
- llegdist = (v3(ll.Position.x,rut.Position.y-1.8,ll.Position.z)-lpos).Magnitude
- local rtdist,ltdist = getdistfrowtorsotowall()
- local torot
- if rlegdist > llegdist then
- torot = -rlegdist/15
- elseif rlegdist < llegdist then
- torot = llegdist/15
- elseif rlegdist == llegdist then
- torot = 0
- end
- changesound(hit)
- local hit,pos,rot = rayc(rut.Position,v3(rut.Position.x,-10000,rut.Position.z),{char},4.5)
- sine = sine+change
- local vervel = rut.Velocity.y
- local tvel = (rut.Velocity * v3(1,0,1)).Magnitude
- local Ccf=rut.CFrame
- local Walktest1 = hum.MoveDirection*Ccf.LookVector
- local Walktest2 = hum.MoveDirection*Ccf.RightVector
- local rotfb = Walktest1.X+Walktest1.Z
- local rotrl = Walktest2.X+Walktest2.Z
- local legoff = rotfb
- if rotfb <0 then
- legoff = 0
- end
- if anim == "idle" and hit then
- nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(-sin(sine/idledevider/1.5)*rad(2.5),-cos(sine/idledevider/5)*rad(2.5),rad(0)),animspeed)
- if not sitting and not laying then
- rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,sin(sine/idledevider/1.5)/12.5,0)*angles(rad(0),rad(0),rad(0)),animspeed)
- if not holdingtool then
- rs.C1 = rs.C1:Lerp(rsc1 * cf(0,.05+cos(-sine/idledevider/1.5)/17.5,.05+cos(-sine/idledevider/1.5)/17.5)*angles(cos(sine/idledevider/1.5)/1.5*rad(5),cos(sine/idledevider/1.5)/1.5*rad(10),rad(-2.5)),animspeed)
- else
- rs.C1 = rs.C1:Lerp(rsc1 * cf(0,0,-cos(-sine/idledevider/1.5)/17.5),animspeed)
- end
- ls.C1 = ls.C1:Lerp(lsc1 * cf(0,.05+cos(-sine/idledevider/1.5)/17.5,.05+cos(-sine/idledevider/1.5)/17.5)*angles(cos(sine/idledevider/1.5)/1.5*rad(5),-cos(sine/idledevider/1.5)/1.5*rad(10),rad(2.5)),animspeed)
- rh.C1 = rh.C1:Lerp(rhc1 * cf(0,sin(sine/idledevider/1.5)/12.5,0)*angles(rad(0),rad(5),rad(-5)),animspeed)
- lh.C1 = lh.C1:Lerp(lhc1 * cf(0,sin(sine/idledevider/1.5)/12.5,0)*angles(rad(0),rad(-5),rad(5)),animspeed)
- end
- if sitting or laying then
- rutj.C1 = rutj.C1:Lerp(rutjc1,animspeed)
- rs.C1 = rs.C1:Lerp(rsc1,animspeed)
- ls.C1 = ls.C1:Lerp(lsc1,animspeed)
- rh.C1 = rh.C1:Lerp(rhc1,animspeed)
- lh.C1 = lh.C1:Lerp(lhc1,animspeed)
- end
- elseif anim == "sit" then
- nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(-sin(sine/idledevider/1.5)*rad(5),-cos(sine/idledevider/5)*rad(5),rad(0)),animspeed)
- rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,sin(sine/idledevider/1.5)/12.5,0)*angles(rad(0),rad(0),rad(0)),animspeed)
- if not holdingtool then
- rs.C1 = rs.C1:Lerp(rsc1 * cf(0,.05+cos(-sine/idledevider/1.5)/17.5,.05+cos(-sine/idledevider/1.5)/17.5)*angles(cos(sine/idledevider/1.5)/1.5*rad(5),cos(sine/idledevider/1.5)/1.5*rad(10),rad(-2.5)),animspeed)
- end
- ls.C1 = ls.C1:Lerp(lsc1 * cf(0,.05+cos(-sine/idledevider/1.5)/17.5,.05+cos(-sine/idledevider/1.5)/17.5)*angles(cos(sine/idledevider/1.5)/1.5*rad(5),-cos(sine/idledevider/1.5)/1.5*rad(10),rad(2.5)),animspeed)
- rh.C1 = rh.C1:Lerp(rhc1 * cf(0,0,-sin(sine/idledevider/1.5)/12.5)*angles(rad(0),rad(5),rad(-5)),animspeed)
- lh.C1 = lh.C1:Lerp(lhc1 * cf(0,0,-sin(sine/idledevider/1.5)/12.5)*angles(rad(0),rad(-5),rad(5)),animspeed)
- elseif anim == "jump" then
- nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(rad(-10),rad(0),rad(0)),animspeed*2.5)
- rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,0,0)*angles(-rotfb/4,0,-rotrl/5),animspeed/2)
- if not holdingtool then
- rs.C1 = rs.C1:Lerp(rsc1 * cf(.3,.3,0)*angles(rad(0),rad(-10),rad(-80)),animspeed*2.5)
- end
- ls.C1 = ls.C1:Lerp(lsc1 * cf(-.3,.3,0)*angles(rad(0),rad(10),rad(80)),animspeed*2.5)
- rh.C1 = rh.C1:Lerp(rhc1 * cf(0,-.7,.25)*angles(rad(15),rad(10),rad(0)),animspeed*2.5)
- lh.C1 = lh.C1:Lerp(lhc1 * cf(0,-.3,.3)*angles(rad(-10),rad(-10),rad(0)),animspeed*2.5)
- elseif anim == "fall" then
- nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(rad(20),rad(0),rad(0)),animspeed/15)
- rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,0,0)*angles(-rotfb/3,0,-rotrl/4),animspeed/2)
- if not holdingtool then
- rs.C1 = rs.C1:Lerp(rsc1 * cf(.4,.5,0)*angles(rad(0),rad(-20),rad(-130)),animspeed/15)
- end
- ls.C1 = ls.C1:Lerp(lsc1 * cf(-.4,.5,0)*angles(rad(0),rad(20),rad(130)),animspeed/15)
- rh.C1 = rh.C1:Lerp(rhc1 * cf(0,-.4,.2)*angles(rad(10),rad(10),rad(0)),animspeed/15)
- lh.C1 = lh.C1:Lerp(lhc1 * cf(0,-.1,.25)*angles(rad(-5),rad(-10),rad(0)),animspeed/15)
- elseif anim == "walk" and not slow and hit then
- for i = 0,1,animspeed-(animspeed/5) do
- changesound(hit)
- if not holdingtool then
- rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.025)
- else
- rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.025)
- end
- nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(-rotfb/4.5+cos(sine/5)*rad(2.5)*rotfb,cos(sine/5)*rad(2.5)+rotrl/2,-cos(sine/5)*rad(5)),animspeed)
- rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,sin(sine/2.5)/6.5,0)*angles(cos(sine/5)*3*rad(2.5)*rotfb,cos(sine/5)*3*rad(5),0)*angles(-rotfb/3,0,-rotrl/4),animspeed)
- if not holdingtool then
- rs.C1 = rs.C1:Lerp(rsc1 * cf(0,.05-cos(-sine/5)/5,.05-cos(-sine/5)/5)*angles(rad(5)+cos(sine/5)*3*rad(50)*rotfb,sin(sine/5)*3*rad(12.5),-.075),animspeed)
- end
- ls.C1 = ls.C1:Lerp(lsc1 * cf(0,.05+cos(-sine/5)/5,.05+cos(-sine/5)/5)*angles(rad(5)-cos(sine/5)*3*rad(50)*rotfb,sin(sine/5)*3*rad(12.5),.075),animspeed)
- rh.C1 = rh.C1:Lerp(rhc1 * cf(0,sin(sine/5),cos(sine/5)*1.15*legoff)*angles(-cos(sine/5)*3*rad(50)*rotfb,sin(sine/5)*3*rad(5),-.05-cos(sine/5)*3*rad(30)*rotrl),animspeed)
- lh.C1 = lh.C1:Lerp(lhc1 * cf(0,-sin(sine/5),-cos(sine/5)*1.15*legoff)*angles(cos(sine/5)*3*rad(50)*rotfb,sin(sine/5)*3*rad(5),.05+cos(sine/5)*3*rad(30)*rotrl),animspeed)
- sine = sine +change
- swait()
- end
- footstepsound:Play()
- elseif anim == "walk" and slow and hit then
- for i = 0,1,animspeed-(animspeed/2.2) do
- changesound(hit)
- if not holdingtool then
- rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.25)
- else
- rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.25)
- end
- nec.C1 = nec.C1:Lerp(necc1 * cf(0,0,0)*angles(-rotfb/5.5+cos(sine/3.25)*rad(2.5),rotrl/2.75,cos(sine/3.25)*rad(2.5)),animspeed)
- rutj.C1 = rutj.C1:Lerp(rutjc1 * cf(0,sin(sine/3.25)/8.5,0)*angles(cos(sine/7.5)*rad(2.5),0,0)*angles(-rotfb/5,0,-rotrl/5),animspeed)
- if not holdingtool then
- rs.C1 = rs.C1:Lerp(rsc1 * cf(0,0,0)*angles(rad(5)+cos(sine/7.5)*2*rad(30)*rotfb,-sin(sine/7.5)*2*rad(7.5),-.075),animspeed)
- end
- ls.C1 = ls.C1:Lerp(lsc1 * cf(0,0,0)*angles(rad(5)-cos(sine/7.5)*2*rad(30)*rotfb,-sin(sine/7.5)*2*rad(7.5),.075),animspeed)
- rh.C1 = rh.C1:Lerp(rhc1 * cf(0,sin(sine/7.5)/4,cos(sine/7.5)/2*legoff)*angles(-cos(sine/7.5)*rad(50)*rotfb,sin(sine/7.5)*2*rad(5),-.05-cos(sine/7.5)*2*rad(20)*rotrl),animspeed)
- lh.C1 = lh.C1:Lerp(lhc1 * cf(0,-sin(sine/7.5)/3,-cos(sine/7.5)/2*legoff)*angles(cos(sine/7.5)*rad(50)*rotfb,sin(sine/7.5)*2*rad(5),.05+cos(sine/7.5)*2*rad(20)*rotrl),animspeed)
- sine = sine +change
- swait()
- end
- footstepsound:Play()
- end
- if not sitting and not laying then
- if tvel >2 and vervel <2 and vervel >-2 then
- anim = "walk"
- nec.C0 = nec.C0:Lerp(necc0,.1)
- if not holdingtool then
- rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.1)
- else
- rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.1)
- end
- ls.C0 = ls.C0:Lerp(lsc0,.1)
- rh.C0 = rh.C0:Lerp(rhc0 * cf(0,-rlegdist,-(maxlegdist-rlegdist)/4)*angles(-(maxlegdist-rlegdist)/5,0,0),.1)
- lh.C0 = lh.C0:Lerp(lhc0 * cf(0,-llegdist,-(maxlegdist-llegdist)/4)*angles(-(maxlegdist-llegdist)/5,0,0),.1)
- rutj.C0 = rutj.C0:Lerp(rutjc0,.1)
- elseif hum.Sit == true then
- anim = "sit"
- nec.C0 = nec.C0:Lerp(necc0,.1)
- if not holdingtool then
- rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.1)
- else
- rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.1)
- end
- ls.C0 = ls.C0:Lerp(lsc0,.1)
- rh.C0 = rh.C0:Lerp(rhc0 * cf(0,-1,0) * angles(rad(90),0,0),.1)
- lh.C0 = lh.C0:Lerp(lhc0 * cf(0,-1,0) * angles(rad(90),0,0),.1)
- rutj.C0 = rutj.C0:Lerp(rutjc0*angles(0,0,-torot),.1)
- elseif vervel >2 then
- anim = "jump"
- nec.C0 = nec.C0:Lerp(necc0,.1)
- if not holdingtool then
- rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.1)
- else
- rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.1)
- end
- ls.C0 = ls.C0:Lerp(lsc0,.1)
- rh.C0 = rh.C0:Lerp(rhc0 * cf(0,-rlegdist,-(maxlegdist-rlegdist)/3.5)*angles(-(maxlegdist-rlegdist)/6.5,0,0),.1)
- lh.C0 = lh.C0:Lerp(lhc0 * cf(0,-llegdist,-(maxlegdist-llegdist)/3.5)*angles(-(maxlegdist-llegdist)/6.5,0,0),.1)
- rutj.C0 = rutj.C0:Lerp(rutjc0*angles(0,0,-torot),.1)
- elseif vervel <-2 then
- anim = "fall"
- nec.C0 = nec.C0:Lerp(necc0,.1)
- if not holdingtool then
- rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.1)
- else
- rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(rad(90),-rtdist/1.5,0),.1)
- end
- ls.C0 = ls.C0:Lerp(lsc0 * cf(-ltdist/1.75,0,ltdist/4.5) * angles(0,ltdist/1.5,0),.1)
- rh.C0 = rh.C0:Lerp(rhc0 * cf(0,-rlegdist,-(maxlegdist-rlegdist)/3.5)*angles(-(maxlegdist-rlegdist)/6.5,0,0),.1)
- lh.C0 = lh.C0:Lerp(lhc0 * cf(0,-llegdist,-(maxlegdist-llegdist)/3.5)*angles(-(maxlegdist-llegdist)/6.5,0,0),.1)
- rutj.C0 = rutj.C0:Lerp(rutjc0*angles(0,0,-torot),.1)
- elseif tvel <2 then
- anim = "idle"
- nec.C0 = nec.C0:Lerp(necc0,.1)
- if not holdingtool then
- rs.C0 = rs.C0:Lerp(rsc0 * cf(rtdist/1.75,0,rtdist/4.5) * angles(0,-rtdist/1.5,0),.1)
- else
- rs.C0 = rs.C0:Lerp(rsc0 * cf(0,0,0) * angles(rad(90),0,0),.1)
- end
- ls.C0 = ls.C0:Lerp(lsc0 * cf(-ltdist/1.75,0,ltdist/4.5) * angles(0,ltdist/1.5,0),.1)
- rh.C0 = rh.C0:Lerp(rhc0 * cf(0,-rlegdist,-(maxlegdist-rlegdist)/3.5)*angles(-(maxlegdist-rlegdist)/6.5,0,-torot),.1)
- lh.C0 = lh.C0:Lerp(lhc0 * cf(0,-llegdist,-(maxlegdist-llegdist)/3.5)*angles(-(maxlegdist-llegdist)/6.5,0,-torot),.1)
- rutj.C0 = rutj.C0:Lerp(rutjc0*angles(0,0,-torot),.1)
- end
- end
- swait()
- end
- end)
- anims()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement