my code is:
local TreasureChest = game.ServerStorage:FindFirstChild("TreasureChestBuriedInSand") local newVector3 = Vector3.new(math.random(0,512),0,math.random(0,512)) local newCFrame = CFrame.new(newVector3) local function SpawnChest() TreasureChest:Clone() TreasureChest:Clone() CFrame = newCFrame TreasureChest.Parent = game.Workspace end while true do SpawnChest() print("chest spawned") wait(5) end
Your code has a few erros and you might want to move the Y up so its not in the baseplate
local TreasureChest = game.ServerStorage:FindFirstChild("TreasureChestBuriedInSand") local newVector3 = Vector3.new(math.random(0,512),5,math.random(0,512)) local newCFrame = CFrame.new(newVector3) local function SpawnChest() lcoal treasureChestClone = TreasureChest:Clone() treasureChestClone.CFrame = newCFrame TreasureChest.Parent = game.Workspace end while true do SpawnChest() print("chest spawned") wait(5) end
If this didnt help please give me more info on the error messages if there are any.