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

int value not changing no matter what is picked?

int value not changing

level = game.Workspace.RunningLevel
running = game.ReplicatedStorage.LevelName
Leveltime = game.ReplicatedStorage.Leveltime

if running.Value == redBlock then
	Leveltime.Value = 1

elseif running.Value == SalmonBlock then
	Leveltime.Value = 1
	
elseif running.Value == BlueBlock then
	Leveltime.Value = 1
	end

4 comments

0

Is the default value 0?

0

no

0

What is the default value set at? 1?

0

You have to do a while loop or :GetPropertyChangedSignal to check if the value has changed, that's the problem.

1 answer

as brenden said, you do either use :GetPropertyChangedSignal or any while loops.

while wait() do
level = game.Workspace.RunningLevel
running = game.ReplicatedStorage.LevelName
Leveltime = game.ReplicatedStorage.Leveltime

if running.Value == redBlock then
    Leveltime.Value = 1

elseif running.Value == SalmonBlock then
    Leveltime.Value = 1

elseif running.Value == BlueBlock then
    Leveltime.Value = 1
    end
end

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