local Number = game.workspace.Values.L1.Value
while true do wait()
script.Parent.Text = Number
end
if workspace.Values.resettargets.Value == true then script.Parent.Text ="0"
workspace.Values.L1.Value = 0
end
I feel like this should be working but it is not, can anybody see an error?
![image](//devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/4X/3/5/5/355cb45c53a8c6a681d93a6f56914dccf0e7bcad.png)
![image](//devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/4X/3/5/d/35d9f3c42d082a77593b2566b6a5f6dd1153f640.png)
The value does change so it’s not an issue with the value.
You are only checking if the value is true once. An if statement only runs once you have to put the if statement inside the while loop for it to keep checking the value of resettargets
Even with that line of code in the while true do the text does not change.
![image](//devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/4X/5/2/5/525889b288c082e69cdc32f0ca6e73325c3097e2.png)
In case you were wondering resettargets is set to false to begin with so that cannot be affecting it.
local Number = game.workspace.Values.L1.Value
while true do wait()
script.Parent.Text = Number
end
workspace.Values.resettargets.Value.Changed:Connect(function()
if workspace.resettargets.Value == true then
script.Parent.Text = “0”
workspace.L1.Value = 0
end
end
try this ^^
I didn’t do that but um, I found something weird. It seems that if I use the direct path instead of local Number it works, odd.
while true do wait()
script.Parent.Text = game.workspace.Values.L1.Value
if workspace.Values.resettargets.Value == true then script.Parent.Text ="0"
workspace.Values.L1.Value = 0
end
end
1 Like
The reason why it works like that is because Number is the value of L1 at the beginning and doesn’t change when L1’s value is changed.
3 Likes