Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why this frame visibility changing script isnt working?

ok title explain rly simple script but it doesnt work

local yes = true
local plr = game.Players:WaitForChild(game.Workspace:WaitForChild("PlayerName")).Value
local plrgui = game.StarterGui
script.Parent.MouseButton1Click:Connect(function()
	if yes then
		local crates = plrgui.Crates.Crates
		local crates2 = plrgui.Crates.CurrentCrate
		yes = false
		if crates.Visible == false then
			crates.Visible = true
			crates2.Visible = true
		elseif crates.Visible == true then
			crates.Visible = false
			crates2.Visible = false
		end
		wait(0.5)
		yes = true
	end
end)

1 answer

✓ Accepted answer

I think its just some variable issues; this should hopefully fix the problem. Accept if it helps!

local yes = true
local plr = game:GetService("Players").LocalPlayer
local plrgui = Player.PlayerGui.ScreenGui
script.Parent.MouseButton1Click:Connect(function()
    if yes then
        local crates = plrgui.Crates.Crates
        local crates2 = plrgui.Crates.CurrentCrate
        yes = false
        if crates.Visible == false then
            crates.Visible = true
            crates2.Visible = true
        elseif crates.Visible == true then
            crates.Visible = false
            crates2.Visible = false
        end
        wait(0.5)
        yes = true
    end
end)

1 comment

0

there ya go

This discussion is preserved as it was. New answers, comments, and votes are closed.