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

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

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:(

2 comments

1

You gotta learn Lua first kiddo.

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.

1 answer

✓ Accepted answer

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.

1 comment

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:)

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