my code is:
01 | local TreasureChest = game.ServerStorage:FindFirstChild( "TreasureChestBuriedInSand" ) |
02 | local newVector 3 = Vector 3. new(math.random( 0 , 512 ), 0 ,math.random( 0 , 512 )) |
03 | local newCFrame = CFrame.new(newVector 3 ) |
04 |
05 | local function SpawnChest() |
06 | TreasureChest:Clone() |
07 | TreasureChest:Clone() CFrame = newCFrame |
08 | TreasureChest.Parent = game.Workspace |
09 | end |
10 |
11 | while true do |
12 | SpawnChest() |
13 | print ( "chest spawned" ) |
14 | wait( 5 ) |
15 | end |
Your code has a few erros and you might want to move the Y up so its not in the baseplate
01 | local TreasureChest = game.ServerStorage:FindFirstChild( "TreasureChestBuriedInSand" ) |
02 | local newVector 3 = Vector 3. new(math.random( 0 , 512 ), 5 ,math.random( 0 , 512 )) |
03 | local newCFrame = CFrame.new(newVector 3 ) |
04 |
05 | local function SpawnChest() |
06 | lcoal treasureChestClone = TreasureChest:Clone() |
07 | treasureChestClone.CFrame = newCFrame |
08 | TreasureChest.Parent = game.Workspace |
09 | end |
10 |
11 | while true do |
12 | SpawnChest() |
13 | print ( "chest spawned" ) |
14 | wait( 5 ) |
15 | end |
If this didnt help please give me more info on the error messages if there are any.