I would love for anyone to help me with this issue!
Every time i click on this imagebutton, it refuses to open the infoframe gui.
local frame = script.Parent.Parent.InfoFrame
local button = script.Parent
local function click()
button.MouseButton1Click:Connect(click)
if frame.Visible == false then
frame.Visible = true
else
frame.Visible = false
end
end
I’ve tried looking for solutions to this but to no avail
You are connecting to the button inside the function.
You need to do it like:
local frame = script.Parent.Parent.InfoFrame
local button = script.Parent
local function click()
if frame.Visible == false then
frame.Visible = true
else
frame.Visible = false
end
end
button.MouseButton1Click:Connect(click)
And if you are just gonna change the Visible property you can just use:
local frame = script.Parent.Parent.InfoFrame
local button = script.Parent
local function click()
frame.Visible = not frame.Visible
end
button.MouseButton1Click:Connect(click)
The issue might be that you’re affecting the gui thats is in starterGui, and not the gui that gets replicated to the PlayerGui on runtime. Depending on what you’re affecting and where you placed your script this might be the issue