I am trying to make it so when a player dies, they turn into 50 small bricks. The script clears all the body parts, but does not create any parts. My Script
debounce = false
while true do
if script.Parent.Humanoid.Health == 0 and debounce == false then
debounce = true
local pos = script.Parent:FindFirstChild("Torso").Position
local child = script.Parent:ClearAllChildren()
local model = Instance.new("Model")
model.Name = "temp"
model.Parent = script.Parent
for i=1, 50, 1 do
local b = Instance.new("Part")
b.BrickColor = BrickColor.new(1012)
b.Reflectance = 1
b.Transparency = 0.7
b.CanCollide = false
b.Size = Vector3.new(1,1,1)
b.TopSurface = Enum.SurfaceType.Smooth
b.BottomSurface = Enum.SurfaceType.Smooth
b.Position = pos
b.Parent = model
wait(0.01)
end
wait(2)
model:ClearAllChildren()
end
wait()
end
it is in the players character.

1 comment
Thanks and it did help but i ditched the loop and just used a repeat wait() until script.Parent.Health == 0