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

why wont the variable change?

Asked by
xxaxxaz 42
2 years ago
Edited 2 years ago

I am making a entermession and the varible for the entermession wont change.

game.Players.PlayerAdded:Connect(function(player)

while true do
    wait()
if game.ServerScriptService.System.Action.Value == 1 then
        game.ServerScriptService.System.works.Value = false
        game.ServerScriptService.System.Action.Value = 0
        local time = 20
        while time >= 0 do

            print("Entermession: "..time)
            player.PlayerGui.wordy.TextLabel.Visible = true
            player.PlayerGui.wordy.TextLabel.Text = "Entermession: "..time
            local time = time - 1 -- I feel like it is here but this code has no error.
            wait(1)

        end
        while time == -1 do

            player.ServerScriptService.System.works.Value = true
            local time = false
            player.PlayerGui.wordy.TextLabel.Visible = false

        end
end
    end 
    end)

0
can somebody please answer. xxaxxaz 42 — 2y
0
shouldn’t you use a for loop? 1JBird1 64 — 2y
0
it does not really matter xxaxxaz 42 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Instead of changing the value of the variable, you declare it again in line 14 by putting "local" before it. (meaning, it can't set itself to itself because it doesn't know what it is, if that makes sense).

-- declare the variable with this
local time = 20
-- and change it with this
time = time - 1
0
thx, sorry for not accepting the answer I has not used scriptinghelpers.org in a while and I just got back on. xxaxxaz 42 — 2y
Ad

Answer this question