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.
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.
01 | game.Workspace.Seat.ChildAdded:connect( function (Part) |
02 | if Part.Name = = "SeatWeld" then |
03 | print (Part.Part 1. Parent.Name.. " has sitted !" ) |
04 | --Give gui |
05 | end |
06 | end ) |
07 |
08 | game.Workspace.Seat.ChildRemoved:connect( function (Part) |
09 | if Part.Name = = "SeatWeld" then |
10 | print (Part.Part 1. Parent.Name.. " has jumped off !" ) |
11 | --Remove gui |
12 | end |
13 | end ) |