How to make a hitbox that ignores the localplayer

Hello! I am currently making an ability and i want to ask if it is possible to make a hitbox ignore the player who activated it. I tried everything i can think of(i am super bad at scripting lol). Thank you!

hitbox code:

HB.Touched:Connect(function(hit)
				if game.Players:FindFirstChild(hit.Parent.Name) or hit.Parent.Name == "TestDummy" then
					if hit.Parent:FindFirstChild("Humanoid") then
						print("yes")
						if impactFramePlayed == false then
						
							impactFramePlayed = true
							HB:Destroy()
							game.ReplicatedStorage.Events.BehmothBash:FireClient(plr)
							game.ReplicatedStorage.Events.BehmothBash:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
						wait(0.3)
							hit.Parent:WaitForChild("Humanoid").Health =- 35
							game.ReplicatedStorage.Events.ImpactFrameB:FireClient(plr)
							game.ReplicatedStorage.Events.ImpactFrameEvent:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
							wait(5)
							print("e")
						else
							return
						
						end
					end
				end
			end)
1 Like
HB.Touched:Connect(function(hit)
if hit.Parent.Name == game.Players.LocalPlayer.Name then
return
end

				if game.Players:FindFirstChild(hit.Parent.Name) or hit.Parent.Name == "TestDummy" then
					if hit.Parent:FindFirstChild("Humanoid") then
						print("yes")
						if impactFramePlayed == false then
						
							impactFramePlayed = true
							HB:Destroy()
							game.ReplicatedStorage.Events.BehmothBash:FireClient(plr)
							game.ReplicatedStorage.Events.BehmothBash:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
						wait(0.3)
							hit.Parent:WaitForChild("Humanoid").Health =- 35
							game.ReplicatedStorage.Events.ImpactFrameB:FireClient(plr)
							game.ReplicatedStorage.Events.ImpactFrameEvent:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
							wait(5)
							print("e")
						else
							return
						
						end
					end
				end
			end)```
1 Like

ive tried that, but the thing is it cancels the rest of the code. I still want the Hitbox to be active(because then it would be kinda useless lol)

1 Like

my bad

if hit.Parent.Name == game.Players.LocalPlayer.Name then
return
end
else

				if game.Players:FindFirstChild(hit.Parent.Name) or hit.Parent.Name == "TestDummy" then
					if hit.Parent:FindFirstChild("Humanoid") then
2 Likes

ty so much! it worked! im not good at coding lol so this helped out alot

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.