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

How to make a GUI pop up when clicked a brick?

Asked by 7 years ago

So I put this script in a click detector that was in a brick but it doesn't work. I want the brick when clicked to show text.

function Clicked(Plr) Plr.PlayerGui.Gui.Frame.Visible=true end

script.Parent.MouseClick:connect(Clicked)

Should I rename theScreenGui to PlayerGui to fix it?

1
Please use code blocks when displaying code. hiimgoodpack 2009 — 7y

4 answers

Log in to vote
0
Answered by 7 years ago

You don't need to rename StarterGui to PlayerGui. Roblox automatically does that when the StarterGui is in a player. You need to use :GetPlayerFromCharacter(). Here is how you would use it in your script.

script.Parent.MouseClick:connect(function(Clicked) --This basically activates the function when the thing is clicked.
    game.Players:GetPlayerFromCharacter(Clicked).PlayerGui.Gui.Frame.Visible = true
end)

In the parenthesis of :GetPlayerFromCharacter(), you need the player in the Workspace. Like :GetPlayerFromCharacter(workspace.Player1). Also, you should use :GetPlayerFromCharacter() after the player property like game.Players:GetPlayerFromCharacter().

0
MouseClick event already returns the player who clicked. Goulstem 8144 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

PlayerGui is a main thing for stuff like this. It pops up only for a specific players GUI. I would do this script below.

INSTRUCTIONS! 1). Make sure this script is a script and that it is in the brick with a ClickDetector 2). Change {GUINAME} to whatever GUI you want to open 3). Change FRAMENAME to the frame inside whatever your GUI you want to open is called! 4). You could also edit inside the frame!

script.Parent.ClickDetector.MouseClick:Connect(function(onClick)
    game.Players.LocalPlayer.GUINAME.FRAMENAME.Visible = true
end)

What does this script mean? 1). game.Players.LocalPlayer goes into the games section {Players} and finds the LocalPlayer clicking the button.

IF YOU NEED ANY FURTHER HELP PLEASE MESSAGE BACK TO THIS. I AM A BEGINNER SCRIPTER AND I HAVE A STRONG PASSION FOR IT SO I AM NOT PERFECT, BUT I AM OKAY WITH GUIS AND EDITING PART'S PROPERTIES AND MAKING MODELS APPEAR AND DISAPPEARING.

Hope this helped, -Goldenkings11

0
It worked, but only after a change of a script. radzik9988 -7 — 6y
0
I mean, in the game.Players.LocalPlayer.GUINAME.FRAMENAME.Visible = true line, before GUINAME you need to add .PlayerGui radzik9988 -7 — 6y
0
where do you make the gui in starter gui, cuz there is no PlayerGui until a player joins JakeDaBeAat 13 — 6y
Log in to vote
0
Answered by 6 years ago

You need to use this script:

script.Parent.ClickDetector.MouseClick:Connect(function(onClick)

    game.Players.LocalPlayer.PlayerGui.YourGuiNameHere.YourFrameNameHere.Visible = true

end)

Remember, the script and clickdetector MUST be in the part you want to be clickable!

0
Also where is the V = true, replace the V with Visible. radzik9988 -7 — 6y
Log in to vote
-1
Answered by 7 years ago

put this in a locascript in startergui

game.Workspace.Part.ClickDetector.MouseClick:connect(function() --change part to part name
script.Parent.ScreenGui.TextLabel.Visible = true --change screengui and textlabel to the frame you want to be visible

Answer this question