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

why wont the variable change?

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)

3 comments

0

can somebody please answer.

0

shouldn’t you use a for loop?

0

it does not really matter

1 answer

✓ Accepted answer

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

1 comment

0

thx, sorry for not accepting the answer I has not used scriptinghelpers.org in a while and I just got back on.

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