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

How do I make this script effect all players GUIs? [Unsolved]

local debounce = false

script.Parent.Touched:connect(function(hit)
	if not debounce then
	debounce = true
	
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	
	player.PlayerGui.CapGui.BeingCapped.Text = "Blue Noobs base is being captured!"
	
	for i = 0, 100, 1 do
		wait(0.2)
		player.PlayerGui.CapGui.CapPercentage.Text = i .. "%"
		player.PlayerGui.CapGui.CapAnimation.Size = UDim2.new(0, i, 0, 30)
	end
	
	if player.PlayerGui.CapGui.CapPercentage.Text == "100%" then
		player.PlayerGui.CapGui.BeingCapped.Text = "Blue Noobs base has been captured!"
	end
	
	debounce = false
	end
end)

This only effects the player that steps on the brick. How do I edit it to make it so that when any player steps on it, the GUI shows up for all players? I've tried putting the GUI in StarterGui and it doesn't work.

1 answer

local debounce = false

script.Parent.Touched:connect(function(hit)
    if not debounce then
    debounce = true

    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    local players = game.Players:GetChildren()
    for i=1,#players do
    players[i].PlayerGui.CapGui.BeingCapped.Text = "Blue Noobs base is being captured!"
    end
    for a=1,100 do
        wait(0.2)
        for i=1,#players do
        players[i].PlayerGui.CapGui.CapPercentage.Text = a.. "%"
        players[i].PlayerGui.CapGui.CapAnimation.Size = UDim2.new(0, a, 0, 30)
        end
    end
    for i=1,#players do
        players[i].PlayerGui.CapGui.BeingCapped.Text = "Blue Noobs base has been captured!"
    end

    debounce = false
    end
end)

If this answered your Question, Please remember to Plus 1 Vote and Submit as Answer!

10 comments

0

Doesn't work...

0

Try Now..

0

Nope...

0

What is the output?

0

It just ups the first for loop by 1 and then stops.

0

What line?

0

12

0

Oh, There were Two "i=" statements. Try it now.

0

Thanks for posting all of my Questions as -1. That was real mature.

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