Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago
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

Log in to vote
-2
Answered by 10 years ago
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!

0
Doesn't work... alienantics 15 — 10y
0
Try Now.. duckhunter392 25 — 10y
0
Nope... alienantics 15 — 10y
0
What is the output? duckhunter392 25 — 10y
View all comments (6 more)
0
It just ups the first `for` loop by 1 and then stops. alienantics 15 — 10y
0
What line? duckhunter392 25 — 10y
0
12 alienantics 15 — 10y
0
Oh, There were Two "i=" statements. Try it now. duckhunter392 25 — 10y
0
Thanks for posting all of my Questions as -1. That was real mature. duckhunter392 25 — 10y
Ad

Answer this question