So I'm working on a basic little script, learning the basics of Lua math.
number1 = script.Parent.Name; --The name is 0 number2 = 1; number3 = 10; number4 = 40; function onTouched(hit) print(number1+number2) script.Parent.Name = (number1+number2) wait() end script.Parent.Touched:connect(onTouched)
This is where I am at now, is there a simpler way to do this? When I go to test this, It only goes to 1, and when I go to touch it again it still gives me 1.
number2 = 1; number3 = 10; number4 = 40; function onTouched(hit) number1 = script.Parent.Name -- if this was out side then the name wouldnt update since the code only gets refreshed in the function print(number1+number2) script.Parent.Name = (number1+number2) wait() end script.Parent.Touched:connect(onTouched)