Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does this not work?

I want the script to do this:

When I click the button called "Open", it would show another frame (by default, it's not visible) Is there something wrong with my script? The button changes the text, but the frame isn't showing up.

P.S. Output shows no errors.

script.Parent.MouseButton1Click:connect(function()
	local window = game.StarterGui.ProcessGUI.MainWind
	
	if window.Visible == false then
		window.Visible = true
		script.Parent.Text = "Close"
	else
		window.Visible = false
		script.Parent.Text = "Open"
	end
	
end)

1 answer

✓ Accepted answer

The issue with this is the fact that you're editing the gui which is in the StarterGui service. The problem? The player would only see the change if they were to reset, as this service's contents are only given to the player each time they spawn - No link between the two is maintained past this.

The fix? You need to edit the Visible property of "MainWind" in the player's PlayerGui. You can do this by parenting up to it (assuming that this script is in "ProcessGui") or you can get the LocalPlayer and delve into the ProcessGui through their PlayerGui.

This discussion is preserved as it was. New answers, comments, and votes are closed.