So im really confused on why this isn’t working, it isn’t destroying the shield for some reason and it isn’t working, why?
game.Players.PlayerAdded:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
local shield = char:WaitForChild("shield")
player.BulletHit:GetPropertyChangedSignal("Value"):Connect(function()
if player.BulletHit.Value < 0 then
player.BulletHit.Value = 0
end
end)
shield.Touched:Connect(function(hit)
if hit.Parent == hit.Parent:FindFirstChild("Bullet") then
player.BulletHit.Value = player.BulletHit.Value - 1
player.BulletHit.Changed:Wait()
if player.BulletHit.Value <= 0 then
shield:Remove()
print("removed")
end
end
while shield do
wait()
player.Character.Humanoid.Health = 100
end
if not shield then
player.Character.Humanoid.Health = 100
end
end)
end)