I am trying to make a numbervalue increase by one everytime a tool is activated, but for some reason the number that im increasing the numbervalue by increases by 1 everytime the tool is activated, instead of increasing the numbervalue. Ex:
while true do local num = script.Parent.Value num.Value = num.Value + 1 print (num) wait(1) end
Output: 1 2 4 7 11 ...and so on...
Here is my code, I am referring to the part where is says "elseif y.Name=v.name" https://gyazo.com/8a71086d0b984838610372510ab67191
debounce = false while true do if not debounce then debounce = true local num = script.Parent.Value num.Value = num.Value + 1 print (num) wait(1) debounce = false end
this makes it so the code cant run multiple times at once and u will only get + 1 value for each time
I think your problem is that you have already described what the value is.
Your script is:
while
true
do
local
num
=
script.Parent.Value
num.Value
=
num.Value +
1
print
(num)
wait(``1``)
end
You have already said that the num is the script.Parent.Value. If you use num.value, it'll not worked because num already has the value in it. So try,
while true do local num = script.Parent num.Value = num.Value + 1
or you could say,
while true do local numb = script.Parent.Value num = num + 1
As I have said before, I am not very experienced with scripting, but I think this should help.