I am working on a base that is going to have a wall that can be attacked and when its hit points hit 0 it will disappear. I have made a model and added the part and a humanoid part as well. I am not sure why the block will not disappear when its hit points hit 0. can anyone help me please...
if Script.Parent.Humanoid.Health > 0 then do
Script.Parent.Part.Transparency = 0
Script.Parent.Part.CanCollide = true
if Script.Parent.Humanoid.Health <= 0 then do
Script.Parent.Part.Transparency = 1
Script.Parent.Part.CanCollide = false
end
as well if you have a better code feel free to share.
ok, revised issues.....
This is what I have now it works kind of....
It will change one block transparency and not the others.
help please... lol
this is how it is set up
Workspace
Model
Script
Model
Model
Model
Model
Model
Model
Model
This is the script
for i,v in pairs(script.Parent:GetChildren()) do
if not v:IsA("Script") then
v.Humanoid.Changed:connect(function()
if script.Parent.Model.Humanoid.Health > 0 then
script.Parent.Model.Part.Transparency = 0
script.Parent.Model.Part.CanCollide = true
elseif script.Parent.Model.Humanoid.Health <= 0 then
script.Parent.Model.Part.Transparency = 1
script.Parent.Model.Part.CanCollide = false
end
end)
end
end

1 comment
Fixed mine