I need to add a loop to a piece of code so it continuously checks whether the value has been changed but when I do that it also affects other parts of the code.
' local Value = game.Players.LocalPlayer.Powers.Turret.Value local key = Value script.Parent.Text = Value '
I need to add a loop for this code but if I do it affects the code below because I have already defined value and key and also if I cover the code with a loop it affects it.
You can turn this block of code into a function and then use the while loop to check if the value has been changed like so:
function ValueChecker() local Value = game.Players.LocalPlayer.Powers.Turret.Value local key = Value script.Parent.Text = "Value"
and then I after you're done with this you can continuously call the function using while true do like so (include this at the end or after your function)
while true do wait(0.5) ValueChecker() end
you can change the wait to however long you want it to be but don't delete it as it reduces lag a ton. Also if your "end" at the end of the while true do event is underlined, add a bracket at the end like this:
while true do wait(0.5) ValueChecker() end)
k bye