Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local p = game.Players.LocalPlayer
- local serv = game:GetService("UserInputService")
- --workspace.Gravity = 98.1
- local m = p:GetMouse()
- local axcelSpeed = 1--how fast the car speeds up
- local Tiregrip = 0.5--how fast the car slows down
- local prog = 0
- local Tprog = 0
- local letoff = true -- wether or not the car have letoff
- local speed = 10--how fast the car goes
- local turnspeed = 1 -- how fast u turn
- local vel = Vector3.new(0,0,0)
- local intensity = 20 -- how much you want the fov to change
- local maxLean = 11.25 -- the max degrees your car will lean back when moving
- local carHeight = 0 -- how high up ur car is going to be
- speed = speed/10
- turnspeed = turnspeed/10
- local last = Vector3.new(0,0,0)
- local FPS = 0
- spawn(function()
- local startT = tick()
- local count = 0
- game:GetService("RunService").RenderStepped:Connect(function()
- if tick()-startT>=1 then
- startT = tick()
- FPS = count
- count = 0
- --print(FPS)
- else
- count = count+1
- end
- end)
- end)
- local since = math.huge
- local gain = false
- function chat(msg)
- local all = game.Players:GetChildren()
- game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer(msg, 'All')
- --p:Chat(msg)
- end
- local anim = Instance.new("Animation")
- anim.AnimationId = "rbxassetid://129342287"
- repeat wait() until p.Character~=nil
- local hums = p.Character:WaitForChild("Humanoid")
- local original
- if hums then
- local animation1 = hums:LoadAnimation(anim)
- animation1:Play()
- animation1:AdjustSpeed(1)
- local r = p.Character:FindFirstChild("HumanoidRootPart")
- repeat wait() r = p.Character:FindFirstChild("HumanoidRootPart") until r
- local joint = r:WaitForChild("RootJoint")
- if joint then
- print("changing joint")
- joint.C0 = CFrame.new(0,carHeight,0)*CFrame.Angles(math.pi/2,math.pi,0)
- original = joint.C0
- end
- end
- local function reX(cframe)
- local x, y, z = cframe:ToOrientation()
- return CFrame.new(cframe.Position) * CFrame.Angles(0,y,z)
- end
- function Lerp(a, b, c)
- return a + ((b - a) * c)
- end
- local randoN = 0
- local back
- spawn(function()--MADE BY DOJJ0 ! ! !
- local startTick = tick()
- back = game:GetService("RunService").RenderStepped:Connect(function()
- if tick()-startTick>=((0.0166666667*FPS)-1)/150 then
- startTick = tick()
- local c = p.Character
- if c then
- local root = c.PrimaryPart
- if root then
- local hum = c:FindFirstChild("Humanoid")
- if hum and hum.Health>0 then
- local mag = (last-root.Position).Magnitude*10
- last = root.Position
- local look = root.CFrame.LookVector
- prog = math.clamp(prog-Tiregrip,0,100)
- if letoff == true then
- if prog>=95 and gain == false then
- randoN = math.random(1,10)
- print(randoN)
- gain = true
- --print("gaining")
- since = tick()
- --prog = math.random(50,70)
- else
- if prog>=95 then
- --print("gaining speed")
- if tick()-since>= randoN then
- local to = math.random(50,70)
- spawn(function()
- for i = .1,1,.1 do
- wait()
- prog = Lerp(prog,to,i)
- end
- end)
- since = math.huge
- gain = false
- print("letting off")
- else
- --print(tick()-since)
- end
- else
- gain = false
- since = math.huge
- --print("lost gain")
- end
- end
- end
- local calc2 = math.clamp(math.floor(mag*1000),0.1,1)
- --print(calc2)
- local cam = workspace.CurrentCamera
- if cam then
- cam.FieldOfView = 70+((intensity/100)*prog)
- end
- if not serv:IsKeyDown(Enum.KeyCode.A) and not serv:IsKeyDown(Enum.KeyCode.D) then
- if Tprog<0 then
- --print("under")
- if Tprog+Tiregrip*8>0 then
- Tprog = 0
- else
- Tprog = Tprog+Tiregrip*8
- end
- else
- --print("over")
- if Tprog-Tiregrip*8<0 then
- Tprog = 0
- else
- Tprog = Tprog-Tiregrip*8
- end
- end
- end
- --print(Tproh)
- local torso = c:FindFirstChild("HumanoidRootPart")
- if torso then
- local joint = torso:FindFirstChild("RootJoint")
- if joint then
- --print(((maxLean/100)*prog))
- joint.C0 = original*CFrame.Angles(math.rad(-((maxLean/100)*prog)),math.rad(((maxLean/100)*Tprog)),0)
- end
- end
- c:SetPrimaryPartCFrame(reX(c:GetPrimaryPartCFrame())*CFrame.new(0,0,-(((speed/100)*prog)*calc2))*CFrame.Angles(math.rad(((maxLean/100)*prog)),0,0))
- c:SetPrimaryPartCFrame(root.CFrame*CFrame.fromOrientation(0,(turnspeed/100)*(Tprog*((speed/100)*(100-(prog/1.5)))),0))
- else
- back:Disconnect()
- end
- end
- end
- end
- end)
- end)
- local run
- local startTick2 = tick()
- run = game:GetService("RunService").RenderStepped:Connect(function()
- if tick()-startTick2>=((0.0166666667*FPS)-1)/150 then
- startTick2 = tick()
- local c = p.Character
- if c then
- local hum = c:FindFirstChildOfClass("Humanoid")
- if hum and hum.Health>0 then
- --hum.WalkSpeed = 0
- if serv:IsKeyDown(Enum.KeyCode.W) then
- local root = c.PrimaryPart
- if root then
- local look = root.CFrame.LookVector
- prog = math.clamp(prog+(axcelSpeed*2),0,100)
- --vel = (look*((speed/100)*prog)).Unit
- --print(vel)
- end
- end
- if serv:IsKeyDown(Enum.KeyCode.A) then
- --print("left")
- local root = c.PrimaryPart
- if root then
- Tprog = math.clamp((Tprog+axcelSpeed*(8)),-100,100)
- --root.CFrame = root.CFrame*CFrame.fromOrientation(0,(turnspeed/100)*Tprog,0)
- end
- end
- if serv:IsKeyDown(Enum.KeyCode.D) then
- --print("right")
- local root = c.PrimaryPart
- if root then
- Tprog = math.clamp((Tprog-axcelSpeed*8),-100,100)
- end
- end
- if serv:IsKeyDown(Enum.KeyCode.S) then
- local root = c.PrimaryPart
- if root then
- local look = root.CFrame.LookVector
- prog = math.clamp(prog-Tiregrip*2,0,100)
- --vel = (look*((speed/100)*prog)).Unit
- end
- end
- else
- run:Disconnect()
- end
- end
- end
- end)
- m.KeyDown:Connect(function(key)
- if string.lower(key)=="e" then
- chat("beep beep!")
- else
- if string.lower(key)=="q" then
- chat("vroom vroom")
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement