Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to use collectionservice to change humanoid health of tagged enemies?

Asked by 2 years ago

I have this script, no errors in output but its not seeming to work. i have a part the spawns and if the player touches it, i want all the enemies tagged "Zombie" to have there health set to 1. heres the script


wait(1) function onTouched(part) if part.Parent.Name == "Zombie" then game.Workspace["power ups"].NT:Play() else if part.Parent:findFirstChild("Humanoid") then game.Workspace["power ups"].IK:Play() script.Parent.Position = Vector3.new(0, -50, 0) local CS = game:GetService("CollectionService") local temp = CS:GetTagged("Zombie") for i in pairs(temp) do local ZomHum = temp[i]:FindFirstChild("Humanoid") ZomHum.Health = 1 wait(30) end end end end script.Parent.Touched:connect(onTouched)
0
this script doesn't do the tagging though, how are we supposed to help you then? RAFA1608 543 — 2y

Answer this question