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

My GUI is not Popping up when you click! What should I do?

Asked by 3 years ago
Edited 3 years ago

I have been having issues when I click the button that the frame does not pop up any way I change the code I need help, here is the code.


script.Parent.MouseButton1Click:Connect(function() game.StarterGui.ToolGui.ToolFrameGui.Visible = true end)

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

FIX:

script.Parent.MouseButton1Click:Connect(function()
      script.Parent.Parent.Parent.Parent.Parent.PlayerGui.ToolGui.ToolFrameGui.Visible = true
end) 
0
Thank you Etrnal_Dev 9 — 3y
0
I got a problem it now says PlayerGui is not a valid member of ScreenGui and when I do the other one it says PlayerGui is not a valid member of PlayerGui Etrnal_Dev 9 — 3y
0
ok lemme fix User#29913 36 — 3y
0
Try using WaitForChild("PlayerGui") as it waits for a child to be added. JesseSong 3916 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

It seems that you are a beginner. I will explain what StarterGui, StarterPlayerScripts & what StarterCharacter is for. They are for putting things inside, that the core scripts of roblox will automatically put their contents inside of a player when they joined, for example if a player joins, and you have a gui inside of StarterGui, the roblox corescripts will clone the gui, and set the cloned gui's parent to the new player's playergui. Here is your fixed code, assuming your script is inside of the clickdetector object which is inside of your part:

script.Parent.MouseClick:Connect(function(player)

    player.PlayerGui.ToolGui.ToolFrameGui.Visible = true

end)

OR if you are making a gui pop up from a textbutton, here is your code, assuming that your textbutton is located inside of a frame which is inside of a screengui:

script.Parent.MouseButton1Click:Connect(function()


    script.Parent.Parent.Parent.Parent.ToolGui.ToolFrameGui.Visible = true

end)

Happy to help, if you have any other questions feel free to add me on Discord: Haunted#5196

Answer this question