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

How do you regenerate a block?

I made a script so that a block gets unanchored after you touch it, so it falls down from a tall height, now how do I make it so that it comes back as it is in the same position?

3 answers

Clone it before it's properties are changed then clone the clone into Workspace.

1 comment

0

Sorry, I'm a noob at scripting, how do I clone blocks?

I'm going to use example variables since I don't what the variables of your brick are.

local Position = Origin.Position
Origin = script.Parent
local Lighting = game.GetService('Lighting')

new=Origin:clone
new.Parent = Lighting
local debounce = false

function anchor(v)
         if Origin.Anchored = true then
        Origin.Anchored = false
end

function onTouched(hit)
	local humanoid = hit.Parent:findFirstChild("Humanoid")
	if humanoid~=nil and debounce == false then
		debounce = true

		debounce = false
	end
end

wait(24)

new.Parent = Workspace
new.Position = Position
 
return
script.Parent.Touched:connect(onTouched)

That should work, but message me if it doesn't.

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