Hello,
How can I be able to create a script that always check’s the status of the NumberValue in example? Something like a loop?
You can use an event to do this. Additionally it is more efficient than a loop as events run only when the value is changed rather than every frame or second like in a loop. (This is polling which is considered bad)
Example code given:
local function printValue(value)
print(value)
end
Workspace.NumberValue.Changed:Connect(printValue)
Workspace.NumberValue.Value = 20
--print 20 in Output
the global variable Workspace
is deprecated, use workspace