Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I set a new intvalue on touch?

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?

1 comment

0

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

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.