Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I regen this model in the same position after making it fall and dissapear?

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

1 comment

0

You could turn them back anchored and collidable after a certain time before they fall to the void...you could make clones by doing local x = v:Clone() v.Anchored = false wait(sometime) x.Parent = V'sParent...you could reanchor them when they hit a certain height

1 answer

✓ Accepted answer

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

2 comments

0

I will check it out tomorrow, thank you so much.

0

Update: it worked, thank you so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.