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

Getting to the PlayerGui?

Asked by 10 years ago

This is what i tryed Ik it sucks

function onclickedofheader() player = workspace:FindFirstChild(player) game.player.PlayerGui.ScreenGui.Frame.Visible = true end

workspace.Header.ClickDetector.MouseClick:connect(onclickedofheader)

How do i get the PlayerGui when they click a part?

1 answer

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago
local brick = script.Parent
local click = brick:WaitForChild("ClickDetector")

click.MouseClick:connect(function(player_who_clicked)
    local player = game.Players:GetPlayerFromCharacter(player_who_clicked.Character)
    local gui = player.PlayerGui:findFirstChild("ScreenGui")
    if gui then 
        gui.Frame.Visible = true
    end
end)
Ad

Answer this question