Annoying debuging with position

I wanted to draw a cube with 4x1x4 plates but this happen.
image

How i do fix it?

local x = 0
local z = 0
for i = 1, 100 do
	task.wait()
	local plateclone = script.Parent:Clone()
	plateclone.Script:Destroy()

	x += 4
	if x >= 40 then
		x = 0
		z += 0
		z += 4
	end

	plateclone.Position = Vector3.new(x, 0, z)
	plateclone.Parent = workspace
end

1 Like

make the loop loop 99 times instead of 100 i just tested that

local x = 0
local z = 0
for i = 1, 99 do
	task.wait()
	local plateclone = script.Parent:Clone()
	plateclone.Script:Destroy()

	x += 4
	if x >= 40 then
		x = 0
		z += 0
		z += 4
	end

	plateclone.Position = Vector3.new(x, 0, z)
	plateclone.Parent = workspace
end

{6EDB17B2-434A-4AF7-93A7-33E1CA70E067}

none of working :confused:

Figured it out. Set your x variable to -4 at the start, and keep the for loop at i = 1,100, or just move the x += 4 line after the position is set

local x = -4
local z = 0
for i = 1, 100 do
	task.wait()
	local plateclone = script.Parent:Clone()
	plateclone.Script:Destroy()

	x += 4
	if x >= 40 then
		x = 0
		z += 0
		z += 4
	end

	plateclone.Position = Vector3.new(x, 0, z)
	plateclone.Parent = workspace
end
1 Like

Thank you. i am struggling with this annoying things for around 10 min

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.