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

How to change values all at once?

Asked by 10 years ago

I'm trying to make the countdown appear on every screen at once instead of changing the values on one player at a time. Here's the code:

local players = game.Players:GetPlayers()
    for i = 1, #players do
        players[i].Character.Humanoid.NameOcclusion = Enum.NameOcclusion.OccludeAll
        local stats = players[i].PlayerGui.fullGui.everything.gamePlay.informer
        local spawn = game.ServerStorage.WeaponSpawns:Clone()
        spawn.Parent = Workspace
        stats.Text = '3'
        wait(1)
        stats.Text = '2'
        wait(1)
        stats.Text = '1'
        wait(1)
        stats.Text = 'Begin!'
        stats.FontSize = 'Size48'
        wait(2)
        stats.Text = ''
        wait(1)
        stats.Text = 'Objective: Find a weapon. '
        stats.FontSize = 'Size36'
    end

1 answer

Log in to vote
0
Answered by 10 years ago

Instead try this:

Steps:

1.) Insert a StringValue into Lighting called "Alert"

2.) Put this in the main script:

local spawn = game.ServerStorage.WeaponSpawns:Clone()
local alert = game.Lighting.Alert
spawn.Parent = Workspace

for i = 3, 1, -1 do
    alert.Value = i
    wait(1)
end
alert.Value= "Begin!"
wait(2)
alert.Value = ""
wait(1)
alert.Value = "Objective: Find a weapon."

3.) Put this in the informer textlabel or whatever it is:

local keystrings = {}
local alert = game.Lighting:WaitForChild("Alert")
keystrings["Begin!"] = true

update = function()
    script.Parent.Text = alert.Value

    if keystrings[alert.Value] then
        script.Parent.FontSize = "Size48"
    else
        script.Parent.FontSize = "Size36"
    end
end

alert.Changed:connect(update)
update()

This should work, if not give me output or whatnot

1
Nope RedneckBane 100 — 10y
3
What happened? Also instead of down-voting and saying "Nope" I think feedback would be more constructive. VariadicFunction 335 — 10y
Ad

Answer this question