For example, I have to press whatever key to turn on the lights or lock your car, is there any way to make that kind of script?
How to add keys to a VehicleSeat?
1 answer
Hello Gam3r_Play3r. I believe I have a way you could go about this. Note that I will not be providing exact working code, rather explaining how to do this.
I had a similar issue a while back when making a vehicle, in order to make this work I used a script in the seat and had a value in the script named Sitting. I used this value to tell me when somebody is sitting in it, and then I also had a value named PlayerName, so that I could get the players name.
To get this to work, all you need to do is use TouchedService:
local Seat = script.Parent
Seat.Touched:Connect(function(Hit)
local Player = game.Players:FindFirstChild(Hit.Parent.Name)
if Player then
script.Sitting = true
script.PlayerName = Hit.Parent.Name
else
return false
end
end)
Seat.TouchEnded:Connect(function(Hit)
script.Sitting = false
script.PlayerName = ""
end)
The above script just changes the values which can then be detected by another script, best of luck! Remember if this helped you, please accept it! ;D
1 comment
what?
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
No Roblox already did that for you but if you want to change the control yes