Hi, I'd like to ask how would I make so when I leave a seat, the GUI that was turned on when entering the seat turns off.
My small code so far that turns on the GUI:
game.Workspace.Seat:WaitForChild("SeatWeld") game.Players.LocalPlayer.PlayerGui.seatgui.Frame.Visible = true
A better way to do this is to listen for the "Occupant" property of the seat being changed. Here's how it should look:
local seat = workspace.Seat function SeatChanged(propertyChanged) if propertyChanged == "Occupant" then if seat.Occupant then game.Players.LocalPlayer.PlayerGui.seatgui.Frame.Visible = true else game.Players.LocalPlayer.PlayerGui.seatgui.Frame.Visible = false end end end seat.Changed:connect(SeatChanged)
What this code does is connect the SeatChanged function with any property of the seat being changed. From there, it checks if the property that was changed was "Occupant", which is the player when the seat is occupied. Then, it simply checks if the player exists in that property; If not, it closes the GUI, if so, it opens it.
If I've helped you, be sure to mark my answer correct :)