So I have been learning scripting for a few days now, and I made this script that makes the stairs turn black, go through the ground, and unanchor. But I can't figure out how to regen this model. I tried cloning it several ways but that didn't work. (Maybe I am doing it wrong) Please help guys!
local Model = game.Workspace.Stairs for _,v in pairs(Model:GetChildren()) do if v:IsA("BasePart") then v.Touched:connect(function(Hit) if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") then v.Color = Color3.new(0,0,0) --Color turns black wait(0.3) v.CanCollide = false v.Anchored = false end end) end end
Well, once they fall into the void, they're gone.
Your script is a solid base, though.
local Model = game.Workspace.Stairs for _,v in pairs(Model:GetChildren()) do local debounce = false if v:IsA("BasePart") then v.Touched:connect(function(Hit) if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and debounce == false then local stairclone = v:Clone() stairclone.Parent = Model v.CanCollide = false v.Transparency = 1 debounce = true stairclone.Color = Color3.new(0,0,0) --Color turns black wait(0.3) stairclone.CanCollide = false stairclone.Anchored = false wait(5) v.CanCollide = true v.Transparency = 0 debounce = false end end) end end
It clones the stair prior to it falling and regens 5 seconds after falling. There is also a 'debounce' put in, for each part. If you have stood on the part. It will activate the debounce so it won't keep creating clones. As the for loop will not update to see a clone, the clone is merely the falling stair, whilst the actual stair is turned transparent and non-collidable.
I hope this helped.
Thanks,
Explosion