I am trying to make a booking system, and I am trying to make it so if you sit in a seat, and your username does not match the true owner of the seat (which the username of the true owner is in a string value), then it will jump you. I have tried with many attempts, but I have not succeeded. How do you go about this? My scripts are below. I have both the local script and standard script as a child of the seat.
-- Local Script
local Username = script.Parent.Parent:WaitForChild("Username")
local UsernameValue = Username.Value
script.Parent.ChildAdded:Connect(function()
if script.Parent.Occupant.Parent.Name == UsernameValue then
local donothing = game
else
script.Parent.KickOutOfSeat:FireServer()
end
end)
-- Normal Script
script.Parent.KickOutOfSeat.OnServerEvent:Connect(function()
script.Parent.SeatWeld:Destroy()
script.Parent.SeatWeld:Destroy()
script.Parent.SeatWeld:Destroy()
script.Parent.SeatWeld:Destroy()
script.Parent.SeatWeld:Destroy()
script.Parent.SeatWeld:Destroy()
script.Parent.SeatWeld:Destroy()
script.Parent.SeatWeld:Destroy()
end)

2 comments
This won't work ever is the problem, you simply can't use a localscript this way.
Also why do you hate the seat weld so much?