Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make a sword or weapon deal damage to multiple Humanoid names?

I have 3 different humanoids I want to take damage from my weapons, Humanoid, Enemy, and Marine. I cant get them all to take damage only one at a time. How can I make a weapon damage all of them at once?

1 answer

✓ Accepted answer

You could use the FindFirstChildOfClass function to get any Humanoid, reguardless of their name.

example;

script.Parent.Touched:Connect(function(hit)
	local h = hit.Parent:FindFirstChildOfClass("Humanoid");
	if h then
		h:TakeDamage(20);
	end
end)

2 comments

0

Thanks man thats exactly what i'm looking for! ill try put it in a sword.

0

Worked right away!

This discussion is preserved as it was. New answers, comments, and votes are closed.