Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you regenerate a block? [closed]

Asked by 9 years ago

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?

Closed as Not Constructive by iluvmaths1123, Perci1, and TheMyrco

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

3 answers

Log in to vote
0
Answered by
3rdblox 30
9 years ago

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

0
Sorry, I'm a noob at scripting, how do I clone blocks? TheSkaterGamer 0 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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.

Log in to vote
0
Answered by
faruque 30
9 years ago

This might help. http://wiki.roblox.com/index.php?title=Instantiation_of_a_part