How am I able to set a new intvalue? I have a certain value and that value is 1 I want to 1 to change to 2 on a touch based function. How would I do that?
✓ ANSWER ACCEPTED
How do I set a new intvalue on touch?
1 answer
✓ Accepted answer
Remember that this isn't a request site, but as it was only a small request I will be happy to do it.
I was completely unsure of what you meant as your question contained very little detail, but I just made it so that when a part is touched it will change a value to 2. I also added a debounce so that the code will not run multiple times. Here is the code that I put together.
Code:
local intvalue = 1
local debounce = false
script.Parent.Touched:Connect(function()
if not debounce then
debounce = true
intvalue = 2
wait(5)
debounce = false
end
end)
Please accept my answer if this is the code that you wanted. :)
1 comment
1
You're encouraging requests.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Do you mean just counting up every time a part is touched?