I am trying to work on my inventory. However my open and close button will not work. Here is the script:
script.Parent.Parent:WaitForChild("Pets").Visible = not script.Parent.Parent:WaitForChild("Pets").Visible
end)
I am trying to work on my inventory. However my open and close button will not work. Here is the script:
script.Parent.Parent:WaitForChild("Pets").Visible = not script.Parent.Parent:WaitForChild("Pets").Visible
end)
May you show us your whole script and not just a piece of it?
Alright. That was meant to be the full thing, but it has glitched, or maybe it got updated since I have not been on in a while.
This is the whole script. Yes, it is small. It is just for a open and close button for my inventory.
That still does not open/close the GUI.
Is it a local script?
Here is a new version of it:
local petsFrame = script.Parent.Parent:FindFirstChild("Pets")
script.Parent.MouseButton1Click:Connect(function()
petsFrame.Visible = not petsFrame.Visible
end)
Give that a go and see how it is.
Yes it is a local script. Also, I will try it. Thanks!
Try this?
script.Parent.MouseButton1Click:Connect(function()
If script.Parent.Parent:WaitForChild("Pets").Visible == true then
script.Parent.Parent:WaitForChild("Pets").Visible = false
else
script.Parent.Parent:WaitForChild("Pets").Visible = true
end
end)
Also, should I change the petFrame just to āPetsā, since that is the name of it. I have been taking breaks from scripting, so I donāt really remember stuff.
Never mind, It works! Thank you!
No need, since it is just a ānicknameā for the pets frame.
No worries!
Alright. Thank you!! Hope you have a good day/night!
I figured out what was wrong with your own script, it looks like there was a typo in Connect
.
You accidently put 3 nās in Connect instead of 2.
Oh, must of been my keyboard, ahahha. Yeah sometimes some of my keys donāt respond, or sometimes duplicates themselves. Thanks for pointing that out! Appreciate it!