TouchedEnded not working that well, how can I fix this?

Hello, when I run the function TouchedEnded, it fires almost as soon as the part has been touched.

– If you could help without giving Player.Magnitude <= 10… ect that would be great!

– Cheers Creative Side-B

1 Like

Do you have a debounce in your Touched script? A player will always have multiple Touched events whenever they hit a Part.
Try putting a print(“touched”) inside your function to show how many times it fires whenever your player touches the Part.

Yes, I do have a debounce, it is just, when I run the touchEnded event it fires practically as soon as the touched event has run.

Please post your script so we can see what’s up.

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if db == false then
			if isDisabled.Value == false then
				hitted = true
				db = true
				Func(hit)
			end
		end
	end
end)

local TEDB = false -- a second db

script.Parent.TouchEnded:Connect(function(hit)
	if TEDB == false then
		TEDB = true
		print(hit)
	end

	-- this prints as soon as the touch event fires
end)

How big is the part that you’re calling .TouchEnded on?

1 Like

Nvm, my code was perfectly part, thanks for everybodys ‘help’ sorry for wasting your time.
The solution:
– Make a seperate db = for both .Touched and .TouchEnded

1 Like

A Debounce Patterns | Roblox Creator Documentation needs a timed event, that’s the purpose of a debounce. Otherwise your script is running multiple times every single time the Touched and events fire.
Like I said, try putting the print I suggested in the first function to show you how many times the Touched event is firing.