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

Any Reason This Variable May Not Assign?

if game.Workspace.NextMap.Value >= 1 then
		local mapNumber = game.Workspace.NextMap.Value
		game.Workspace.NextMap.Value = 0	
	else
		local mapNumber = math.random(3)
	end~~~~~~~~~~~~~~~~~


I've checked, the value for NextMap is 2. Please Help. I'm new to this site lol

1 comment

0

is this looped or is 2 the value to begin with?

1 answer

✓ Accepted answer

It doesn't work because you're rewriting a variable the wrong way.

local mapNumber = math.random(3)
if game.Workspace.NextMap.Value >= 1 then
	mapNumber = game.Workspace.NextMap.Value
	game.Workspace.NextMap.Value = 0    
else
	mapNumber = math.random(3)
end

You should set mapnumber outside of the if statement. Also, when rewriting variables, you don't place local before the variable name.

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