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:
1 | while true do |
2 | local num = script.Parent.Value |
3 | num.Value = num.Value + 1 |
4 | print (num) |
5 | wait( 1 ) |
6 | 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
01 | debounce = false |
02 | while true do |
03 | if not debounce then |
04 | debounce = true |
05 | local num = script.Parent.Value |
06 | num.Value = num.Value + 1 |
07 | print (num) |
08 | wait( 1 ) |
09 | debounce = false |
10 | 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,
1 | while true do |
2 | local num = script.Parent |
3 | num.Value = num.Value + 1 |
or you could say,
1 | while true do |
2 | local numb = script.Parent.Value |
3 | num = num + 1 |
As I have said before, I am not very experienced with scripting, but I think this should help.