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
4 years ago
Edited 4 years ago

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

01game.Players.PlayerAdded:Connect(function(player)
02 
03while true do
04    wait()
05if game.ServerScriptService.System.Action.Value == 1 then
06        game.ServerScriptService.System.works.Value = false
07        game.ServerScriptService.System.Action.Value = 0
08        local time = 20
09        while time >= 0 do
10 
11            print("Entermession: "..time)
12            player.PlayerGui.wordy.TextLabel.Visible = true
13            player.PlayerGui.wordy.TextLabel.Text = "Entermession: "..time
14            local time = time - 1 -- I feel like it is here but this code has no error.
15            wait(1)
View all 27 lines...
0
can somebody please answer. xxaxxaz 42 — 4y
0
shouldn’t you use a for loop? 1JBird1 64 — 4y
0
it does not really matter xxaxxaz 42 — 3y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 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).

1-- declare the variable with this
2local time = 20
3-- and change it with this
4time = 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 — 3y
Ad

Answer this question