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

Fix this gui script about gui staying on all the time plz ?

Well, basically what happens, BOTH sounds play at the same time and "Kill all enemies" gui stays on screen all the time and it doesn't even reach "all enemies dead". halp

local s = Instance.new("Sound")
s.Name = ("Bellsounde")
s.Parent = game.Workspace
s.SoundId = "rbxassetid://138258242"
s.Volume = 4
local e = Instance.new("Sound")
e.Name = ("Bellsound")
e.Parent = game.Workspace
e.SoundId = "rbxassetid://6891548543"
e.Volume = 4

game.Workspace.trap.Touched:Connect(function()
	for _,player in pairs(game.Players:GetPlayers()) do
		for _,player in pairs(game.Players:GetPlayers()) do
			player.PlayerGui.KILLALLENEMIES2.Enabled = true
			e:Play()
			wait(2)
			player.PlayerGui.KILLALLENEMIES2.Frame.Visible = 0
	end
	wait(5)
	for _,player in pairs(game.Players:GetPlayers()) do
		player.PlayerGui.ALLENEMIESDEAD2.Enabled = true
		s:Play()
		wait(2)
			player.PlayerGui.ALLENEMIESDEAD2.Frame.Visible = 0
			end
		end
		end)

2 answers

It seems to me that you put an 'end' keyword in the wrong place. You should also use true or false when setting the visibility of a Frame (or any element for that matter).

game.Workspace.trap.Touched:Connect(function()
    for _,player in pairs(game.Players:GetPlayers()) do
        for _,player in pairs(game.Players:GetPlayers()) do
            player.PlayerGui.KILLALLENEMIES2.Enabled = true
            e:Play()
            wait(2)
            player.PlayerGui.KILLALLENEMIES2.Frame.Visible = false -- true/false required
		end -- 'end' added here
    end
    wait(5)
    for _,player in pairs(game.Players:GetPlayers()) do
        player.PlayerGui.ALLENEMIESDEAD2.Enabled = true
        s:Play()
        wait(2)
        player.PlayerGui.ALLENEMIESDEAD2.Frame.Visible = false -- true/false required
        -- you had an 'end' here (removed)
    end
end)

If this worked, I would appreciate the answer being accepted. If it did not help you, please give a more detailed explanation of what should or should not be happening and I will try to assist you.

EDIT I noticed that you had 2 'for' loops (1 nested) that do the exact same things. You only needed one.

game.Workspace.trap.Touched:Connect(function()
    for _,player in pairs(game.Players:GetPlayers()) do
	    -- 'for' loop removed
            player.PlayerGui.KILLALLENEMIES2.Enabled = true
            e:Play()
            wait(2)
            player.PlayerGui.KILLALLENEMIES2.Frame.Visible = false -- true/false required
    end
    wait(5)
    for _,player in pairs(game.Players:GetPlayers()) do
        player.PlayerGui.ALLENEMIESDEAD2.Enabled = true
        s:Play()
        wait(2)
        player.PlayerGui.ALLENEMIESDEAD2.Frame.Visible = false -- true/false required
        -- you had an 'end' here (removed)
    end
end)

Hey there!

Instead of "0" beside "Frame.Visible" you need to put a true or false statement.

True meaning yes. False meaning no.

-- So if you want the frame to not be visible do:

Frame.Visible = false

-- If you want it to be visible do:

Frame.Visible = true.

If I helped, please accept this answer as solved! Not only will I get a reward, but you will too!

Edit: If it didn't work, try setting it to false.

2 comments

0

Uh uh, doenst work

0

So you want the GUI to go?

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