How to adjust the number of touched:Connect?

I’m making a game of throwing original plates, and I’ve walked diva-uns when they hit each other, but I can’t think of a way to reduce Touch:Connect itself.

1 Like

You can add a timer and then add an if statement and check if it’s above the limit, you can do it with flags (boolean values) also if you are checking for a player you should check for Humanoid existence, here is an example with timer:

local Timer = 0
 
while true do
     Timer = Timer + 1
     wait(1)
end

script.Parent.Touched:Connect(function()
  if Timer > 5 then -- Change 5 to your limit if you want
   --Do your thing
   Timer = 0
  end
end)

Boolean values:

local Flag = false
 
script.Parent.Touched:Connect(function()
  if Flag ~= true then 
   Flag = true
   --Do your thing
   Flag = false
  end
end)
1 Like

I can’t accurately guess the issue you’re having. Is it perhaps anything to do with debounce? Does the touch function only need to be used once?