Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by
Sam4550 42
10 years ago

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

Log in to vote
1
Answered by
Asleum 135
10 years ago

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)
Ad

Answer this question