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

When u sit on a seat and a gui pop up(onTouch) help? [closed]

Asked by 9 years ago

This question already has an answer here:

Gui.visible = true OnTouch help me?

function onTouch(Part) wait(1) game.StarterGui.ScreenGui.Frame.Visible = true wait(1) end script.Parent.Touched:connect(onTouch)

Marked as Duplicate by 1waffle1, Azmidium, and Goulstem

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 9 years ago

This hasn't been tested.

script.Parent.Touched:connect(function(hit)
local hitplayer = game.Players:GetPlayerFromCharacter(hit.Parent) -- we must somehow get the player
if (hitplayer) then -- if what hit it was a player then
local screengui = hitplayer.PlayerGui:FindFirstChild("ScreenGui") -- defining the 'ScreenGui'
if (screengui) then -- if there a is 'ScreenGui' then
screengui.Frame.Visible = true -- making the frame visible
wait (4)
screengui.Frame.Visible = false -- making the frame invisible
        end
    end
end)

Hope it works for ya!

Ad