I've got a LocalScript here, wondering how I can detect when a Player is touching another Player. I know that this function will fire many times when using the Touched Function so I'll know when to use Debounce and all that.

Humanoid.Touched:Connect(function(hit, humanoidPart)
			
	if not hit.Parent:FindFirstChild("Humanoid") and not hit.Parent:FindFirstChild("Model") then -- Is this right? or is it just "hit"? I'm also wondering how to tie in the player's legs so I do not know where to put humanoidPart into place.

		--Do Code

	end

end)

Thanks,

LukeGabriel

EDIT:

I have it working right here lol.

Humanoid.FreeFalling:Connect(function()
	Humanoid.Touched:Connect(function(hit, humanoidPart)
		if humanoidPart.Name == "Left Leg" or humanoidPart.Name == "Right Leg" then
			
			if not hit.Parent:FindFirstChild("Humanoid") and not hit.Parent:IsA("Accessory") then

			    if Humanoid:GetState() == Enum.HumanoidStateType.Landed and Humanoid.FloorMaterial ~= Enum.Material.Air and Debounce then 
				    Debounce = false
					TravelEvent:FireServer(EquipScript)
					wait(1)
					Debounce = true
				end
		
			end
		
		end
	end)
end)

1 comment

0

Have you even tested the script to see if it works? I am not clear as to what is going on.