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) 

1 comment

0

this script doesn't do the tagging though, how are we supposed to help you then?