Problem with Tool.Activated Event

  1. What do you want to achieve? Keep it simple and clear!

How do I make it so that when you click the mouse button once, an event is triggered and does not work indefinitely?

  1. What is the issue? Include screenshots / videos if possible!
    Isn’t haven’t an errors in output;
  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
script.Parent.Activated:Connect(function()
	local region = handle.region
	
	region.Touched:Connect(function(part)
		if part.Name == "Pollen" then
			if part.Size ~= Vector3.new(3,0.25,3) then
				part.Size /= Vector3.new(1,2,1)
			end
		end
	end)
	
end)
1 Like

Maybe try to use the Activate() method?

I suggest adding a Boolean and checking if its been set to true e.g:

As well make sure that this code is in a Client script or in client run context

local clicked = false

script.Parent.Activated:Connect(function()
    if clicked == false then
          local region = handle.region
	
	region.Touched:Connect(function(part)
		if part.Name == "Pollen" then
			if part.Size ~= Vector3.new(3,0.25,3) then
				part.Size /= Vector3.new(1,2,1)
			end
		end
	end)
    end	
end)

As well I recommend you use UserInputService or player:GetMouse() instead. Iv linked the articles for those below.

https://create.roblox.com/docs/reference/engine/classes/UserInputService

https://create.roblox.com/docs/reference/engine/classes/Mouse#Button1Down