Hi, im still extremely new so please bear that in mind.
I got a small system setup where it spawns apples in a specific area. It copies an apple model from ServerStorage and then spawns it. The apple in server storage has CanCollide set to false, Anchored to true, and transparency to 0.
local appleTemplate = ServerStorage:WaitForChild("Fruits"):WaitForChild("Apple")
local function spawnAppleForPlayer(player)
local playerFolder = playerFruitsFolder:FindFirstChild("Player_" .. player.UserId)
if not playerFolder then return end
if #playerFolder:GetChildren() >= 50 then
return
end
local apple = appleTemplate:Clone()
apple:SetAttribute("Owner", player.UserId)
local angle = math.random() * math.pi * 2
local randomRadius = math.sqrt(math.random()) * RADIUS
local offset = Vector3.new(
math.cos(angle) * randomRadius,
1.4,
math.sin(angle) * randomRadius
)
apple.Position = workspace.Platform.Position + offset
apple.CanCollide = false
apple.Anchored = true
apple.Parent = playerFolder
end
local function startSpawning(player)
task.spawn(function()
while player.Parent do
spawnAppleForPlayer(player)
task.wait(SPAWN_INTERVAL)
end
end)
end
Above is the spawn code. I left some variables and functions out cause of character limit. It works, it spawns the apples and keeps track of who's apples are who through folders. Problem is that when the apples spawn partly inside of eachother, sometimes after a while they seperate, which shouldnt happen cause they are anchored.
Besides that, they are still collidable, I can still touch them.