Help With Close button

my Close button wont work and i dont understand why here’s my script

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()

player.PlayerGui.ToolShop.Frame.Visable = false

end)

2 Likes

its a typo, Visible not Visable

4 Likes

Also in a local script in a gui you do not need playergui just do:

script.Parent.Visible = --value --  Add More parents considering your area 
1 Like

o simple mistake thank you so much !

my script is still not working

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
player.PlayerGui.ToolShop.Frame.Visible = false
end)

where did you put the local script

umm my brain because online wont work for me

no I meant what is it parented to

Does it say anything in the output? That would be helpful

Is the button you are trying to close a TextButton not a TextLabel?

let me check inside ToolShop so I can fix it

My LocalScript:


Where I stored the localscript:
ScriptPlace
Tends to work fine
Try Adding WaitForChild before the playergui for it might have not been loaded by that time and also for the rest.

1 Like

Is it a local script? If not, then it has to be one.

1 Like

Is it in the text button? Or is it a normal script. Maybe you can check the output.

can i have a look of the property and explorer section

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
repeat wait()
player.PlayerGui.ToolShop.Frame.Visible = false
until player.PlayerGui.ToolShop.Frame.Visible == false
end)

1 Like

The reason this doesn’t work is because the frame that you’re turning invisible doesn’t contain the textbutton under it. Make the TextButton a child of the frame.

1 Like

I did not notice that, you speak the truth!

Try making an RemoteEvent that will fire in the local script after click and server script that will listen to event will sclose the gui.

The frame would only need to be closed on the client. I dont think you can modify a players gui using server scripts outside of PlayerGui.

Mithrandir is right most likely…