local loopingValueObject = enemyState.Looping
local function loop()
if loopingValueObject.Value then return end
loopingValueObject.Value = true
while loopingValueObject.Value do
print("Looping")
wait()
end
end
local function endLoop()
if not loopingValueObject.Value then return end
loopingValueObject.Value = false
end
This is what I want to do when a certain value needs to be in a value object for clients to see, but I’m wondering if this going to have any performance issues
if it does then my solution is to use a variable and a value object
local loopingValueObject = enemyState.Looping
local looping = false
local function loop()
if looping then return end
looping = true
loopingValueObject.Value = true
while looping do
print("Looping")
wait()
end
end
local function endLoop()
if not looping then return end
looping = false
loopingValueObject.Value = false
end
but this version is more work than just using a value object
I know the performance will likely not matter for most cases, but I’m more worried about very vast loops as it would be checking the value a ton of times, instead of just comparing to a variable