This script is located at spawn, But players still can place parts named Brick1 But the script does not remove the Part that its desired to remove, What is my error to in pairs getting the childrens?

while game:GetService("RunService").Heartbeat:wait() do
	for i, v in pairs(game.workspace:GetChildren()) do
		if v and v.Name == "Brick1" and (v.Position - script.Parent.Position).magnitude <= 350 then
			v:remove()
		else
		end
	end
end

4 comments

0

Are the parts that the players build made on server or client side?

0

The players will click anywhere to spawn the block from the As a local script into the workspace, But I need the script to remove the blocks by the spawn with the name "Brick1" To be remove them to stop spawn cluster

0

So are the bricks created by a local script? If yes then make it a serverscript since it will only be seen local tp the player

0

to*