✓ Accepted answer
the answer above ain't gonna work cause the problem is in your "stat" variable, instead of using game.StarterGui... and so on try going like script.Parent.Parent... so here's an example:
local Button = script.Parent
local stat = script.Parent.Parent:WaitForChild("Frame")
Button.MouseButton1Click:Connect(function()
if stat.Visible == false then
stat.Visible = true
else
stat.Visible = false
end
end)
make sure to correct the frame position if it's incorrect.
Now there's nothing wrong with this script but if you want you can get shorter script by using what person above suggested, in this case it'll look similar to this:
local Button = script.Parent
local stat = script.Parent.Parent:WaitForChild("Frame")
Button.MouseButton1Click:Connect(function()
stat.Visible = not stat.Visible
end)
Good luck, hope this helped.
2 comments
Can't upvote because of my rep, but this answer should work. Since this would be a LocalScript, you can also use game.Players.LocalPlayer.PlayerGui.Menu.Frame
Smart. I can upvote you tho xD but I'm just here to help people not to gain reputation and stuff...