Hey there! Currently what I have clones a model at the position of the spawner but what I want to do is make it spawn with a random X and Z value while being positioned within the spawn part. What do I do to randomize the position of the cloned model and make it clone multiple models simultaneously?
math.randomseed(tick())
local seedSpawn = script.Parent
local seeder = seedSpawn.Parent
while wait(0.25) do
if seeder.SeederControl.CanPlant.Value == true and seeder.Parent.DriveSeat.Velocity.magnitude > 5 then
local xPos = seedSpawn.Position.X
local yPos = seedSpawn.Position.Y
local zPos = seedSpawn.Position.Z
local cornClone = game.ServerStorage.CornCrop:Clone()
cornClone.Parent = game.Workspace
cornClone:SetPrimaryPartCFrame(CFrame.new(xPos,yPos - 1,zPos))
cornClone:SetPrimaryPartCFrame(CFrame.new(cornClone.PrimaryPart.Position) * CFrame.Angles(0, math.random(100), math.rad(-90)))
end
end

1 comment
Use math.random(miniumvalue, maxiumvalue)