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

My Gui works only in roblox studio,but he don't work in roblox server. What i have to do?

My Gui works only in roblox studio,but he don't work in roblox.

local frame = script.Parent.Parent.Box
local OpenClose = script.Parent.Parent.Open
local OpenClose = false
script.Parent.MouseButton1Down:connect(function(Open)
	if OpenClose == false then
		frame.Visible = true
		OpenClose = true
	elseif OpenClose == true then
		frame.Visible = false
		OpenClose = false
	end
end)

So, this is code for some gui, when I test it it runs fine. But when I use regular servers outside of studio it doesn't work. I'm also try to use thus code

local frame = script.Parent.Parent.Parent:WaitForChild("Box")
script.Parent.MouseButton1Click:connect(function()
	frame.Visible = not frame.Visible
end)

but this also doesn't work.

4 comments

1

First of all, make sure that the scripts are Local Scripts instead of normal Scripts, second, why local OpenClose has two meanings I mean, local OpenClose = script.Parent.Parent.Open and local OpenClose = false so you may change the last OpenClose to Close or FalseClose, change the name and it should work.

1

Thank you for help now it's working. I did it in script, not in Local script.

0

In line 4 on MouseButton1Down, it has no parameters.

1

2 things cound your parents 2 in the first script 3 in the second and use :Connect :connect is deprecated

1 answer

✓ Accepted answer

Try this local script (be sure it's a local script and not a normal script):

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Parent.Visible = not script.Parent.Parent.Parent.Visible
end)

It should work, I haven't tested it out.

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