Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a ScreenGui appear when a Player sits in a seat?

How on earth do I add a script so that when someone sits in a seat, a GUI comes up? When they get out of the seat, the GUI disappears. The GUI would be a ScreenGui and should only come up if you're a certain rank in a group.

The ScreenGui would then be used, for example, to control a Part that would appear and disappear on click of a TextButton within the ScreenGui.

Any help would be appreciated.

1 answer

✓ Accepted answer

When a player sits on a Seat or VehicleSeat object, a Weld called SeatWeld is added in the seat, and it's removed when the player "unsits". That way, using the ChildAdded and ChildRemoved events on your seat, you can detect when a player has sited, and give him a gui for example.

game.Workspace.Seat.ChildAdded:connect(function(Part)
if Part.Name == "SeatWeld" then
print(Part.Part1.Parent.Name.." has sitted !")
--Give gui
end
end)

game.Workspace.Seat.ChildRemoved:connect(function(Part)
if Part.Name == "SeatWeld" then
print(Part.Part1.Parent.Name.." has jumped off !")
--Remove gui
end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.