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

Make GUI visible when player sits on a seat?

Just need to make a GUI appear when a player sits on the seat.

while true do
wait()
local player = game.Players:GetPlayerFromCharacter(script.Parent.Occupant.Parent)
	if player == game.Players.LocalPlayer.Character then
game.Players.LocalPlayer.PlayerGui.TestingGUI.TextBox.Visible = true

end

end

1 answer

✓ Accepted answer

There is a humanoid event just for this called seated:

local player = game:GetService('Players').LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild('Humanoid')

humanoid.Seated:Connect(function(active)
	player.PlayerGui.TestingGUI.TextBox.Visible = active
end)

Put this in a local script in StarterGui.

You could also make this into a server script pretty easily.

More information on the seated event: https://developer.roblox.com/en-us/api-reference/event/Humanoid/Seated

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