How to make a Racing Game Speed Booster?

Hello everyone!
So I’ve been working on a racing game for a while, and now I think it is time to add a speed bosst pad that makes your kart much faster for 5 seconds. I already created a base with the moving beam, but what about the script part? I am zero at scripting :frowning: . Btw the car chassis I use are from Roblox’s Fast and Furious cars.

1 Like

You need a touched event in your car to detect that the wheels have touched the boost pad. When that .touched event occurs you need to either make the wheels spin faster to create the boost or have a Force in the car to boost it.

To make a “Racing Game Speed Booster” We need 3 things:

  1. The model of the speed booster (Which you already have)
  2. The model of your car (You have it too)
  3. And the script of the speed booster (We are going to make it)

So first, let’s start with our Variables if you don’t know what that is, it basically makes everything in your life easier. (literally)

local speedbooster = workspace.speedbooster --Put here where its located
local debounce = true --This will save our life by adding a cooldown

Put this inside your speed booster script, and let’s proceed.
Now we’ll need to use a Function so we can see what touched our car. See more about (Detecting Collisions) here.

script.Parent.Touched:Connect(function(hit)
if hit:FindFirstAncestor("Car") and debounce then --In "Car" you can put the name of your Car

Here we used our Function to get if a part hit our booster and check if it has an ancestor called “Car”.

local Car = hit.Parent
local Seat = Car:FindFirstChildOfClass("VehicleSeat")
local Motor = Car:FindFirstChildOfClass("Motor")
Motor.speeds = Seat.Throttle * 50
debounce = false
wait(1)
debounce = true
end
end)

And finally up there, we set some variables, and specified the motor speed

So finally, the entire code should be this one :

local speedbooster = workspace.speedbooster --Put here where its located
local debounce = true --This will save our life by adding a cooldown

script.Parent.Touched:Connect(function(hit)
if hit:FindFirstAncestor("Car") and debounce then --In "Car" you can put the name of your Car
local Car = hit.Parent
local Seat = Car:FindFirstChildOfClass("VehicleSeat")
local Motor = Car:FindFirstChildOfClass("Motor")
Motor.speeds = Seat.Throttle * 50
debounce = false
wait(1)
debounce = true
end
end)

You can also help me! :wink:

If something doesn’t works, you can help by telling me!
or
If it works, please mark this as solved and like

This last line is incomplete, but unnecessary, i would remove it. Also, it won’t hurt to have a debounce in here as well. Other than that great explanation.

Oh yeah, i typed it incorrectly, my fault.

Wow thank you guys so much! I will try everything as soon as possible!

There seems to be a problem. I use chassis on karts and I am not sure if the vehicle seat actually controlls the kart. There is a whole folder of settings.

I’ve had a look at the Roblox off road racing game example before and I don’t think that it used VehicleSeat inputs.
This may be your issue.