I made some code to find the name of a person that sits in the car seat. It puts the name as a string value. Is it possible to find if a player sits in the seat to kick him out of the seat if his name isn't the string values name?
local seat = script.Parent
local owner = script.Parent.Owner
local Players = game:GetService("Players")
seat:GetPropertyChangedSignal('Occupant'):Connect(function()
if (seat.Occupant) then
local player = game.Players:GetPlayerFromCharacter(seat.Occupant.Parent)
if (not player or not player:FindFirstChild('PlayerGui')) then return;
end
LockGUI = player.PlayerGui:WaitForChild("LockGui").StarterRaftLock
local locked = LockGUI.Locked
owner.Value = seat.Occupant.Parent.Name
if not LockGUI.Visible then
LockGUI.Visible = true
end
end
end)
seat:GetPropertyChangedSignal('Occupant'):Connect(function()
if not (seat.Occupant) then
LockGUI.Visible = false
end
end)
