I recently attempted to create my own UI, since I am relatively new to scripting on Roblox Studio. I needed to create a frame, and for some reason, the way I always did, and saw from tutorials, didn’t work. I thought that it was a waste of time to go back to watching tutorials, so Instead, I decided to ask the rest of the community.
Here’s the code:
local Button = script.Parent
local Frame = Button.Parent.Frame
Button.MouseButton1Click:Connect(function()
Frame.Visible = true
if Frame.Visible == true then
Frame.Visible = false
end)
end)
It would be much appreciated if someone could find the reason for why this isn’t working. Like I said, I’m very new to coding, so please take it easy on me.
local Button = script.Parent
local Frame = Button.Parent:WaitForChild("Frame")
Button.MouseButton1Click:Connect(function()
Frame.Visible = not Frame.Visible
end)