Just like the title said, I want to know how I can detect if a number value in workspace is equal to a certain number, im my case its 6, a script with this code: if game.workspace.NumberValue.Value == 6 then end doesnt work please help me this has been bugging me all day
The basics:
You want to detect it, use an if statement like you have.
1 | if game.Workspace.NumberValue.Value = = 6 then |
2 | --do what you need to do here. |
3 | end |
However that will only detect it once. If you want to be able to detect when it changes, use a .Changed event, or run it through a wait loop.
If you want it to be a certain number use this
1 | game.Workspace.NumberValue.Changed:Connect( function (changed) |
2 | if changed.Value = = 6 then |
3 | --Run a statement |
4 | end |
5 | end ) |
If you want it to be a Smaller number or equal to use this
1 | game.Workspace.NumberValue.Changed:Connect( function (changed) |
2 | if changed.Value > = 6 then |
3 | --Run a statement |
4 | end |
5 | end ) |
if you want it to be a bigger number or equal to use this
1 | game.Workspace.NumberValue.Changed:Connect( function (changed) |
2 | if changed.Value < = 6 then |
3 | --Run a statement |
4 | end |
5 | end ) |