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

Trying to make my gui disappear after a button is clicked. Whats wrong?

new to roblox studio need some help with this script

local screengui = game.StarterGui.ScreenGui

script.Parent.MouseButton1Click:Connect(function() local allchildren = screengui:GetChildren()

local numofchild = #allchildren
for i = 1, numofchild do
	local child = allchildren[i]
	child.visible = false
end

end)

1 comment

0

line 4, change visible to Visible

1 answer

✓ Accepted answer

It Should Look Like This

script.Parent.MouseButton1Click:Connect(function() 
script.Parent.Parent.Enabled = false
end)

The Script Above Only Does Local For Global Do

script.Parent.MouseButton1Click:Connect(function() 
game.StarterGui.ScreenGui.Enabled = false
end)

Local Is For One Player For Example ChadCoolGuy123 Presses The Button But You Don't It Only Goes Away For Him But Global Is For Everyone For Example ChadCoolGuy123 Presses The Button But You Didn't It Goes Away For Both

2 comments

0

This Script I Put Depends On Where The Button Is Located If It Is Like ScreenGui>Frame>TextButton It Would Be One More Parent

0

Thank you

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