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

How Do You Make A ClickDetector GUI Frame?

Asked by
Lacin1a 12
4 years ago
Edited 4 years ago

I was creating a system when you click a brick, a GUI will pop up. (Local)

My current script I have is:

This was put in a ClickDetector in a Brick In LocalScript

script.Parent.MouseClick:Connect(function()

game.Players.LocalPlayer.PlayerGui.IFE.Frame.Visible = true

end)

IFE is the name of the ScreenGui

0
What is the question again? Can you specify? Is it script related? sleazel 1287 — 4y

1 answer

Log in to vote
0
Answered by
JakyeRU 637 Moderation Voter
4 years ago

Hello. LocalScripts does not work in Workspace and they should be put in StarterPlayerScripts, StarterCharacterScripts, StarterGui, ReplicatedStorage etc...

Use a Script with the MouseClick event. The first argument will be the player who clicked. Just change the Visible property on the server. Here is a toggle Script, every time you click, the Frame will be toggled.

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    game.Players:FindFirstChild(player.Name):WaitForChild("PlayerGui").IFE.Frame.Visible = not game.Players:FindFirstChild(player.Name):WaitForChild("PlayerGui").IFE.Frame.Visible
end)

What is not?

not changes the boolean value of the property Visible.

For example:

print(not true) --> Prints false
print(not false) --> Prints true
Ad

Answer this question