The following script goes into a seat.
local debounce = false
function onTouched(part)
local player = part.Parent
if debounce == false then
debounce = true
print("Debounce is On")
end
wait()
gui = Instance.new("ScreenGui")
local textbox = Instance.new("TextBox")
local plr = Workspace.Parent.Players:FindFirstChild(player.Name)
gui.Parent = plr.PlayerGui
gui.Name = "TrainGui"
textbox.Name = "TrainGui"
textbox.Parent = gui
textbox.Text = "Testing"
textbox.BackgroundTransparency = 1
textbox.Position = UDim2.new(0.5, 0, 0.2, 0)
wait(0.5)
if not script.Parent:FindFirstChild("SeatWeld")then
print("Seat Weld has been lost")
gui:Remove()
print("Gui Removed?")
end
debounce = false
end
script.Parent.Touched:connect(onTouched)
Sometimes 'Gui Removed?' gets printed but the gui that says testing is not removed and on other times it doesn't appear at all.
Is there a better way of finding out whether the player is still seated or is there something wrong in the script itself? ._.
Sorry if there's a rookie mistake somewhere here

2 comments
:remove() is deprecated. Use :destroy() intead.
Check this: http://wiki.roblox.com/index.php?title=Sit_%28Property%29