script.Parent.Touched:Connect(function(hit) if script.Parent.Parent.ProcentValue >= script.Parent.Parent.ProcentValue2 then script.Parent.Parent.TouchValue.Value = 100 end end)
New to scripting, why can I not compare two NumberValues? Is there any way I can get around this? The script is supposed to compare two NumberValues so another value gets the value 100.
Thanks, Xsodar
As stated by killerbrenden in the comments, you need to compare their values not the object itself. A simple fix to this would be adding .Value
in both ProcentValue
and ProcentValue2
. It would look like this.
script.Parent.Touched:Connect(function(hit) if script.Parent.Parent.ProcentValue.Value >= script.Parent.Parent.ProcentValue2.Value then -- As you can tell, we added .Value to both of these here to compare their values rather than the actual object itself. script.Parent.Parent.TouchValue.Value = 100 end end)