Is there a way to force a player out of their seat with a script?

Hello! I’m trying to figure out a way to force a player out of a seat, what I’m trying to implement this system onto is a car system, where you buy a car from the shop, spawn it. And then it’s for a certain player. So I want to make it so that if a different player sits, it kicks them out of the seat/forces them out of it.

Script that I’m using to detect whether this is the car’s owner or not:

local seat = script.Parent.Parent.DriveSeat
local engine = script.Parent.Parent.Engine
seat.Changed:Connect(function(property)
	if property == "Occupant" then
		if seat.Occupant then
			local player = game.Players:GetPlayerFromCharacter(seat.Occupant.Parent)
			if player.Name ~= script.Parent.Parent.CarOwner.Value then
				-- I need to kick the player out of the seat here
			end
	end
end)

Any help is appreciated! :slight_smile:

3 Likes

U want do destroy the seat weld, check this: Teleporting while seated

2 Likes

Thank you! It worked. I used this:

seat.SeatWeld:Destroy()

I found out this cause a multitude of issues, for example the throttle staying at 1 or -1 if the player left while driving the car, which can mess up a script that relies on what the throttle or throttle float is