Hello I have got a script for when touched delete part. But I need it to appear in dif spots in the map apart from a shop and stuff

I need a script so my part can spawn in a different location. But cannot spawn in my shop, eggs ect…

Make a blacklist of which parts your part can spawn. An easy way to do this is with a well-structured dictionary. In the dictionary, put the min and max coordinates of each direction in. The numbers I put in this script are just examples.

local blacklist = {
	["Shop"] = {
		["MinX"] = 10,
		["MaxX"] = 25,
		["MinZ"] = -5,
		["MaxZ"] = 37,
	},
	["Eggs"] = {
		["MinX"] = -22,
		["MaxX"] = -16,
		["MinZ"] = 41,
		["MaxZ"] = 47,
	},
}

When putting your part in a random spot, use a function to check if it is in the blacklisted area.

local function Blacklisted(x, z)
	for name, array in pairs(blacklist) do
		if x >= array["MinX"] and x <= array["MaxX"] then
			return false
		elseif z >= array["MinZ"] and z <= array["MaxZ"] then
			return false
		end
	end
	
	return true
end

Tell me if you need any more help.

Thanks for that. That’s very helpful