Hello, im having problems figuring out how to make a booster where the player inside the car touches the booster part and will make the car chassis go at a certain speed for 5 seconds for example.
I tried using the velocity value but kept getting errors when I tried using vector3. I checked the web but I didnt find any answers, and all devfourms which asked this question were left unanswered.
the only thing i would like to achieve is when the car the player is in touches a part it will boost it to a certain speed for 5 seconds for example and then revert the speed back to normal.
I have tested a new method but it says it’s working but it doesnt actually make it go faster
This is a script in starterplayerscripts:
local Event = game:GetService("ReplicatedStorage").Events.AttackMode
workspace.Stage2.Touched:Connect(function()
Event:FireServer()
print("EventFired")
end)
and the event thing is inside the driveseat of the car:
local isBoosting = false;
local body = script.BodyValue.Value
wait(.5)
coolDownTime = 2;
boostTorque = -10;
function Boost()
if isBoosting == false and script.Parent.Occupant then
isBoosting = true;
local currentTorque = script.Parent.Torque
script.Parent.Torque = boostTorque
script.Parent.Throttle = 1;
print("Boosted")
wait(coolDownTime)
isBoosting = false
script.Parent.Torque = currentTorque
print("RevertedTorque")
end
end
game.ReplicatedStorage.Events:WaitForChild("AttackMode").OnServerEvent:Connect(Boost)
Sorry if I don’t know much about this, but would I put it into the script like this?
local isBoosting = false;
local body = script.BodyValue.Value
wait(.5)
function Boost()
if isBoosting == false and script.Parent.Occupant then
isBoosting = true;
script.Parent.CFrame.LookVector * script.Parent.AssemblyMass
print("Boosted")
wait(coolDownTime)
isBoosting = false
print("RevertedTorque")
end
end
game.ReplicatedStorage.Events:WaitForChild("AttackMode").OnServerEvent:Connect(Boost)
I have tried putting linearvelocity in, it somehow works but am not sure how to make it actually work when the chassis enters the part and activates it and make it go the direction the car is in