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!