local zombie = script.Parent local Humanoid = zombie:WaitForChild("Zombie") while Humanoid.Health < 1 do --I tried Humanoid.Died too wait(0.1) game.Workspace.ZP1.CanCollide = true break end
The script above is supposed to change CanCollide on a part to true, so that another script can recognize that and award all players accordingly, but it doesnt change CanCollide on the part to true. It also doesn't display any errors. Help would be appreciated!
(I've heard theres some errors with .Died not working, but i think if you properly code it right it will work.)
my take to the script:
local zombie = script.Parent local Humanoid = zombie:WaitForChild("Zombie") Humanoid.Died:Connect(function() wait(0.1) local g = zombie:GetChildren() for _,v in pairs(g) do if (v:IsA("BasePart")) then v.CanCollide = true end end end)
you should always check for the children of the zombie and not the zombie for CanCollide itself.
[KEEP IN MIND: Anything that is supposed to damage the zombie that finds the humanoid by name may not do anything and throw an error since your humanoid's name is Zombie, and maybe the scripter of whatever is giving damage didnt use "FindFirstChildOfClass()
" and instead used "FindFirstChild()
"]