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

1 comment
thank you dead walker, heres some more info, TreasureChestBuriedInSand is a model in server storage, the script u helped me with is in server script service what u gave me gives me an error saying CFrame is not a valid member of Model "TreasureChestBuriedInSand" if u do not know why u can just leave this, thank you :)