I am a VERY new scripter, started relatively yesterday/today, i'm trying to make a humanoid block(wall barrier) for a zombie survival game. When the humanoid dies, I want the block to un-anchor and fall
Here's my script so far, and I can't seem to figure out why it won't work. Any help would be appreciated.
Model name Test
local h = game.workspace.Test.Head local b = game.workspace.Test.Humanoid if b.Health == 0 then h.Anchored = false h.CanCollide = true end
K so to start, a debounce will be needed. you will also need to loop the if condition.
local h = game.workspace.Test.Head local b = game.workspace.Test.Humanoid local debounce=false while true do if b.Health == 0 and debounce=false then debounce=true h.Anchored = false h.CanCollide = true wait(0.1) debounce=false end wait(0.1)--keep this here otherwise it runs 30 times a second end
tell me if it helped :)
Hey, xpert, to get into stuff like this I recommend using events, Humanoids have an event called .Died which gets called every time the humanoid's health reaches 0.
To complete the script all you have to do is connect it to a humanoid.Died event!
local h = workspace.Test.Head local b = workspace.Test.Humanoid b.Died:Connect(function() -- Connecting to .Died h.Anchored = false h.CanCollide = true end)