Touched Event Fires Without Touching?

  1. What do you want to achieve?
    I want to fix a bug where the Touched Event fires even though the ball does not touch the character.

  2. What is the issue?
    I don’t really know why this happens. There is no extra hitbox except for the character parts.
    (Skip to 00:10 or slightly earlier) The Ball ‘reacts’ Despite the Body Parts not Touching it

  • There is a Touched Event Indicator at the Bottom Right showing which Body Part ‘touched’ the ball
  • This is not the only occurrence, it occurs sometimes. It also happens with other skill moves and I’m unable to replicate it
  1. What solutions have you thought of so far?
    I figured it might be the properties of Workspace that I changed. But I haven’t any faithful clue. Please help

Touched event is pretty stupid and has terrible hitboxes. I recommend you use a @kinglol123468
Hitbox module

1 Like

You could use my module, but you could also do:

local runservice = game:GetService("RunService")
runservice.Heartbeat:Connect(function()
	local Items = workspace:GetPartsInPart(script.Parent, OverlapParams.new())
	for i,v in pairs(Items) do
		local Character = v:FindFirstAncestorWhichIsA("Model")
		if Character then
			local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
			if Humanoid then
				-- do stuff
			end
		end
	end
end)

Just a simplified version without using the module. But you could always use it. I’d recommend making it custom since theres way more you can do with making it custom, rather than using modules.

1 Like

Use ipairs

Whats the difference between the 2?

Ipairs is faster than pairs and it sorts the table order too.

You can just directly add an “I” before the pair and you’re done.

local runservice = game:GetService("RunService")
runservice.Heartbeat:Connect(function()
	local Items = workspace:GetPartsInPart(script.Parent, OverlapParams.new())
	for i,v in ipairs(Items) do
		local Character = v:FindFirstAncestorWhichIsA("Model")
		if Character then
			local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
			if Humanoid then
				-- do stuff
			end
		end
	end
end)

However it won’t work on a table like this unlike pairs

{A = "apple",B = "mm banana"}
1 Like

Thanks. Hopefully that solves my problems.