Having problem with frame visibility

So I was making a sign that when you click on it, it’ll show the text written in better quality by using frame but when I write the script for it, it won’t work! it is like I can’t connect to starterGUI. what is the problem?

Can you show the script please. Also when the game is running you have to change the players player.PlayerGui to update their Gui. When a client joins, everything from game.StarterGui gets replicated into the Players PlayerGui but this only happens once when they join.

I should use a local script for it, right?

so you are telling me to make it like this??

script.Parent.ClickDetector.MouseClick:Connect(function()
    game.Players.LocalPlayer.PlayerGui.TextGUI.Frame.Visible = true
end)

That would work yes, but it would only work in a local script so yeah you can put it in a local script

Thanks for the information you gave but unfortunately it doesn’t work

The script doesn’t work because local scripts need to be a descendant of one of the following:

  • A Player’s Backpack , such as a child of a Tool
  • A Player’s character model
  • A Player’s PlayerGui
  • A Player’s PlayerScripts .
  • The ReplicatedFirst service

This was taken from the LocalScript | Roblox Creator Documentation page. Personally I recommend placing the local script in StarterPlayerScripts | Roblox Creator Documentation. For the click detector you would have to the path to it from workspace. So something like this:

local clickDetector = workspace.Part:FindFirstChildOfClass("ClickDetector") -- replace workspace.Part with the path to the part the player is clicking
local frame = game:GetService("Players").LocalPlayer.PlayerGui.TextGUI.Frame
clickDetector.MouseClick:Connect(function()
	frame.Visible = true -- if you want to toggle you could do frame.Visible = not frame.Visible
end)
1 Like