Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cf = CFrame.new
- local v3 = Vector3.new
- local cfA = CFrame.Angles
- local rad = math.rad
- local Speed = 1 -- YOUR MOVEMENT SPEED HERE
- local TurningSpeed = .5 -- HOW FAST WILL THE HANDLING BE?
- function CFrameFromTopBack(at, top, back)
- local right = top:Cross(back)
- return cf(at.x,at.y,at.z,
- right.x,top.x,back.x,
- right.y,top.y,back.y,
- right.z,top.z,back.z)
- end
- function tweenCF(startCF,endCF,Step)
- local startTop = (startCF*cfA(rad(90),0,0)).lookVector
- local startBack = startCF.lookVector*-1
- local endTop = (endCF*cfA(rad(90),0,0)).lookVector
- local endBack = endCF.lookVector*-1
- local startPos = startCF.p
- local endPos = endCF.p
- local newCF = CFrameFromTopBack(startPos:lerp(endPos,Step),startTop:lerp(endTop,Step),startBack:lerp(endBack,Step))
- return newCF
- end
- Weeh = function()
- local Base = script.Parent
- local Movement = {["Forward"] = 0, ["Left"] = 0, ["Right"] = 0}
- game:GetService("RunService").RenderStepped:connect(function()
- Movement.Left = false
- Movement.Right = false
- Movement.Forward = false
- local RockingSpeed = 2
- local Offset = .625
- local Rocking = (math.cos(time()*RockingSpeed)*Offset)
- local Forward = (Movement.Forward and Speed or 0)
- local Turning = ((Movement.Left and TurningSpeed) or (Movement.Right and -TurningSpeed) or (Movement.Left and Movement.Right and 0) or 0)
- local FD = cf(Base.Position)*cf(v3(),Base.CFrame.lookVector*1)*cfA(Rocking/10*rad(1),0,Rocking*rad(3))
- Base.CFrame = FD
- Base.CFrame = tweenCF(Base.CFrame,Base.CFrame*cf(0,Rocking/2,Forward)*cfA(0,Turning*rad(1),0),.1)
- -- Base.CFrame (If it's one brick OR IF YOU HAVE WELDS: Do this: YourBasePart.Weld.C1 or C0 if you wish = tweenCF(Base.Weld.C1,Base.Weld.C1 etc
- -- With the FD same story, use weld
- end)
- end
- wait(2)
- Weeh()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement