How to remove the player from a vehicle seat?

I want to remove the player from a vehicle seat if they are not the owner of the vehicle to prevent stealing.

I’ve tried different ways of trying to remove the player such as setting the occupant value to nil or making the player jump.

None of them worked and I didn’t see a function that you can use either like Sit().

You could potentially try to use a ProximityPrompt instead to check that way if the Player is the owner of that certain vehicle? You’ll need to pass something to check though to make sure that they are the true owner

Ok I could try and make one because there is many tutorials about how to make them.

Yeah, I’ll give a brief example

What you could potentially do, is create an ObjectValue for each Vehicle so that it keeps track of who is actually the Owner of that certain Vehicle

  • An ObjectValue is basically just a value that can be stored as an object
local ProximityPrompt = script.Parent.ProximityPrompt
local Seat = script.Parent.Seat
local PlayerCheck = script.Parent.ObjectValue

ProximityPrompt.Triggered:Connect(function(Player) --The first parameter is the player who triggered it
    if PlayerCheck.Value == Player then --This checks if the Player is equal to the Object's Value (Or the Owner)

This is just a sample code oof

1 Like

I already have it so when the vehicle is spawned it changes the name of the vehicle to the name of the person who spawned it. thanks

Does disabling the seat stop people that touch it from going into the seat?

I believe so, I don’t know if it’ll work if you use it with the Sit() function however

I guess ill try it out soon, and find out.

Just lemme know what happens, and be sure to parent the variables into the correct objects :slightly_smiling_face:

1 Like

It works great! It still lets you sit using the function even if the seat is disabled.

1 Like

You can destroy the seat weld in the seat.

1 Like