I’m trying to make a script to spawn a ball every second at 1 of 3 spawn positions by making the ball’s CFrame the CFrame of the spawn. However, whenever I run it, I get the error ServerScriptService.SpawnBall:13: attempt to index number with ‘CFrame’. Here’s my script:
local spawns = {
game.Workspace.BallSpawn1,
game.Workspace.BallSpawn2,
game.Workspace.BallSpawn3,
}
while wait(1) do
local pos = math.random(1,#spawns)
print(pos)
local ball = game.ReplicatedStorage.Ball:Clone()
ball.Parent = game.Workspace
ball.CFrame = pos.CFrame
end