Having trouble creating a "humanoid" wall?

Hi all.

I am trying to make walls which will be attacked by monsters and then upon 0 health break apart.

I read up on the roblox humanoid reference and i created the wall, making sure to name 1 part : Head 1 part : Torso and 1 part : HumanoidRootPart.

I can see it has health now but i am not sure if it is working. I tried to make the health 0 but it doesn’t break into pieces despite choosing break joints on death. The whole structure just remains with health 0.

Hoping to get some insights.

Much appreciated.

1 Like

As it is controlled by a singular value, you can compromise instead and use a IntValue that represents its health. You can script the functionality of breaking on the IntValue reaching 0.

Humanoid performance cost isn’t worth a wall that will only use the health property.

2 Likes
local wall = script.Parent

wall:FindFirstChild("Humanoid").Died:Connect(function()
    wall.Anchored = false
    wait(1)
    wall:Destroy()
end)
1 Like

Oh I see. So it’s not “auto”.

Is there a way to check if my “humanoid” is valid or as long as there is heath it means it’s fine? Thank you

what do you mean if the humanoid is valid? if you want to check as long as there is health do

if wall:FindFirstChild("Humanoid").Health >0 then
   print(wall.Humanoid.Health)
end
1 Like

You should use an int value or something as health for the wall instead of a humanoid since it would be a waste of a humanoid to just use the health property like ArtFoundation said. You could have a simple script like

if script.Parent.Health.Value <= 0 then
    script.Parent:Destroy()
    --or if you wanted to keep the wall you could just
    script.Parent.CanCollide = false
    script.Parent.Transparency = 1
end
1 Like

Sorry I may have been confused by the Roblox ref.

It says to be a valid humanoid, it needs head torso etc etc. The head must be connected to torso. There should be motor6d.

I am missing the motor6d so I am worried that the humanoid is not “proper” and will mess up the game.

i mean, no the humanoid can be inside anything. although, using the methods @kom297 and @ArtFoundation said will be more efficient, this script should work if you have zombies damaging the wall already.

1 Like

If you want a basic way to do a “humanoid wall” simply use intvalues. Also, if you’re looking for a wall that will break with an explosion, do this along with a raycast for a better way

while wait(1) do

local hitraycast = Ray.new(--First tuple is humanoid, -- second tuple is direction)

local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(hitraycast, {-- put in what you want to ignore}  ) -- not depreacted
end

if hit then
game.Workspace.Wall.Health --[[IntValue]] = game.Workspace.Wall.Health - 10

if game.Workspace.Wall.Health < 0 then


local explosion = Instance.new("Explosion")

explosion.Visible = false

explosion.Position = game.Workspace.Wall.Position
wait()
explosion.Visible = true

game.Workspace.Wall:Destroy()





end
end
1 Like

Thank you all for the advice. I really appreciate it.

1 Like