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

Why does this block generating script not work properly when i try to use it?

Please help me it does not want to work

--clockwork

local bin = script.Parent
brick = Instance.new("Part")
brick.FormFactor = 2
parent.BottomSurface = "Smooth"
parent.TopSurface = "Smooth"
brick.Name = "lod"
brick.Size = Vector3.new(6, 4, 6)
brick.BrickColor = BrickColor.new("Cool yellow")
brick.Transparency = 0.1
brick.Anchored = true
brick.CanCollide = true
brick.Material = "Concrete"

enabled = true



function onButton1Down(mouse)
	local player = game.Players.LocalPlayer
	if player == nil then return end
	print("trigger")
	-- find the best cf
	
	spew = true
	while spew do
		wait(0.1)
		newbrick = brick:clone()
		newbrick.Position = mouse.Hit.p
		game.Lighting.GoldDust:clone().Parent = newbrick
		game.Lighting.Remive:clone().Parent = newbrick
		game.Lighting.Chakra:clone().Parent = newbrick
		game.Lighting.Sparkles1:clone().Parent = newbrick
		newbrick.Parent = game.Workspace
		player.PlayerGui.Chakra.Clock.Value = player.PlayerGui.Chakra.Clock.Value - 2
	end
end

function onButton1Up(mouse)
	spew = false
end

function onSelected(mouse)
	print("select")
	mouse.Icon = "rbxasset://textures\\GunCursor.png"
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
	mouse.Button1Up:connect(function() onButton1Up(mouse) end)
end

bin.Selected:connect(onSelected)

2 answers

It seems you made a mistake while scripting, in the lines 6 and 7 it also should be brick, cause a Parent does not know what it is, so

--clockwork

local bin = script.Parent
brick = Instance.new("Part")
brick.FormFactor = 2
brick.BottomSurface = "Smooth"
brick.TopSurface = "Smooth"
brick.Name = "lod"
brick.Size = Vector3.new(6, 4, 6)
brick.BrickColor = BrickColor.new("Cool yellow")
brick.Transparency = 0.1
brick.Anchored = true
brick.CanCollide = true
brick.Material = "Concrete"

enabled = true



function onButton1Down(mouse)
	local player = game.Players.LocalPlayer
	if player == nil then return end
	print("trigger")
	-- find the best cf
	
	spew = true
	while spew do
		wait(0.1)
		newbrick = brick:clone()
		newbrick.Position = mouse.Hit.p
		game.Lighting.GoldDust:clone().Parent = newbrick
		game.Lighting.Remive:clone().Parent = newbrick
		game.Lighting.Chakra:clone().Parent = newbrick
		game.Lighting.Sparkles1:clone().Parent = newbrick
		newbrick.Parent = game.Workspace
		player.PlayerGui.Chakra.Clock.Value = player.PlayerGui.Chakra.Clock.Value - 2
	end
end

function onButton1Up(mouse)
	spew = false
end

function onSelected(mouse)
	print("select")
	mouse.Icon = "rbxasset://textures\\GunCursor.png"
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
	mouse.Button1Up:connect(function() onButton1Up(mouse) end)
end

bin.Selected:connect(onSelected)

1 comment

0

Thank you very much!

You accidentally used "parent" instead of brick in a few places.

local bin = script.Parent
brick = Instance.new("Part")
brick.FormFactor = 2
brick.BottomSurface = "Smooth"
brick.TopSurface = "Smooth"
brick.Name = "lod"
brick.Size = Vector3.new(6, 4, 6)
brick.BrickColor = BrickColor.new("Cool yellow")
brick.Transparency = 0.1
brick.Anchored = true
brick.CanCollide = true
brick.Material = "Concrete"

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