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

how to do that when breaking the block there was another?

Asked by 5 years ago
Edited 5 years ago

when I break a block, I need another one to come under it, but I don't know how to do it. I have a team to command the block, I tried to add my command there, and I did not succeed, because I'm only a new player. cloning of the block:

local object = game.Workspace.blocks.Stone1
local ClonedObject = object:clone()
ClonedObject.Parent = game.Workspace
ClonedObject.Position = Vector3.new(-36.5, 4, 116.4)

end

but I tried to add my own, and I,of course, did not work, look, and help me, please, so that in the future I could fix the error myself:

local object = game.Workspace.blocks.Stone1
repeat
    game.Workspace.blocks.Stone1 = destroy
until

local ClonedObject = object:clone()
ClonedObject.Parent = game.Workspace
ClonedObject.Position = Vector3.new(-36.5, 4, 116.4)

end

I tried to make the function so that it was executed after the block necessary to me will break, but, alas, I couldn't:(

1
You gotta learn Lua first kiddo. User#6546 35 — 5y
0
^ well... I think he's new to Lua coding. and I just noticed the title: "how to do that when breaking the block there was another?" I'm so confused. magicguy78942 238 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

This is Lua. It's unnecessary to put an end at the end of every script. Here's the script I fixed for you:

local oldobject = workspace.blocks.Stone1

oldobject.Changed:connect(function(property)
    if property == "Parent" then
        if not oldobject.Parent then
            local ClonedObject = oldobject:Clone()
            ClonedObject.Parent = workspace
            ClonedObject.Position = Vector3.new(-36.5, 4, 116.4)
            oldobject = ClonedObject
        end
    end
end)

By the way, you should learn Lua better.

0
wow, thank you, Yes,I know I should learn lua better, but I can't find the complete textbooks.P.S. I Russian, therefore I have mistakes in the text:) Dux3dizb 4 — 5y
Ad

Answer this question