Basically what is supposed to happen is randomly a coin should spawn and be placed randomly inside this giant blue area.
To keep things simple,
You have an area you want the coins to spawn in:
You have a coin:
And you have a script that spawns coins randomly through the area:
local coins = workspace.Coins
local area = coins.Area
while true do
if workspace:GetAttribute("CoinsCanSpawn") == true and #coins:GetChildren() <= 101 then
local randomArea = area
local newCoin = game.ReplicatedStorage.Coin:Clone()
Instance.new("Highlight", newCoin) --added for easier view
newCoin.Parent = coins
newCoin.Position = randomArea.Position + Vector3.new(math.random(-randomArea.Size.X/2, randomArea.Size.X/2), 1, math.random(-randomArea.Size.Z/2, randomArea.Size.Z/2))
end
task.wait(math.random(0.1, 2))
end
Problem is, they are only spawning in a straight line:
(I increased the amount of coins that can spawn just so you can see them more clearly)
How do I fix this?