Creating a proximity prompt to sit

Hello, I am trying to create a script that has proximity prompt, and when player presses “E”, the player gets seated.
I tried making the script as
game.Workspace.VehicleSeat.ProximityPrompt.Triggered:Connect(), but I don’t know how to make the
player seated.
Also, I have searched up and found result for making players sit using proximity prompt, but the posts did not help me create the script that make you sit when you press “E” on the proximity prompt.
Thank you!

1 Like

Something very simple:

Seat = 
ProximityPrompt= 
ProximityPrompt.Triggered:Connect(function(Player)
	if Seat.Occupant then			return			end
	Seat:Sit(Player.Character.Humanoid)
	ProximityPrompt.Enabled = false
end)

Define Seat and ProximityPrompt.

2 Likes

Ok, Thanks! I will test out the script and let you know if it worked!

It seemed to work, but when I get out of the seat, the proximity prompt doesn’t work.

That is because your script disables the seat after sitting on it. You should change that.

1 Like

Erase the line that says: ProximityPrompt.Enabled = false

1 Like

I tried erasing it, but if you erase it, the proximity prompt shows when you are sitting.

I have found a solution! It turns out that there was a code sample about using proximity prompt with Seat. Thank you @Zompocolypse and @SOTR654 for trying to help me. :grinning: