Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local p = game.Players.LocalPlayer
- local cas = game:GetService('ContextActionService')
- local serv = game:GetService("UserInputService")
- --workspace.Gravity = 0
- 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 speed = 10--how fast the car goes
- local turnspeed = 1 -- how fast u turn
- local vel = Vector3.new(0,0,0)
- speed = speed/10
- turnspeed = turnspeed/10
- local last = Vector3.new(0,0,0)
- function chat(msg)
- local all = game.Players:GetChildren()
- game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer(msg, 'All')
- --p:Chat(msg)
- end
- spawn(function()--MADE MY DOJJ0 ! ! !
- game:GetService("RunService").RenderStepped:Connect(function()
- local c = p.Character
- if c then
- local root = c.PrimaryPart
- if root then
- local mag = (last-root.Position).Magnitude*10
- last = root.Position
- local look = root.CFrame.LookVector
- prog = math.clamp(prog-Tiregrip,0,100)
- local calc2 = math.clamp(math.floor(mag*1000),0.1,1)
- --print(calc2)
- 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)
- c:SetPrimaryPartCFrame(c:GetPrimaryPartCFrame()*CFrame.new(0,0,-(((speed/100)*prog)*calc2)))
- root.CFrame = root.CFrame*CFrame.fromOrientation(0,(turnspeed/100)*(Tprog*((speed/100)*(100-(prog/2)))),0)
- end
- end
- end)
- end)
- local run
- run = game:GetService("RunService").RenderStepped:Connect(function()
- local c = p.Character
- if c then
- cas:UnbindAction("moveForwardAction")
- cas:UnbindAction("moveForwardAction")
- cas:UnbindAction("moveBackwardAction")
- cas:UnbindAction("moveLeftAction")
- cas:UnbindAction("moveRightAction")
- cas:UnbindAction("jumpAction")
- 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
- 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
- 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)
- 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)
Add Comment
Please, Sign In to add comment