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
4 comments
Thank you
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
ok lemme fix
Try using WaitForChild("PlayerGui") as it waits for a child to be added.