Untitled

Anonymous
plain_text
02/11/2026 1:59 PM
1.1 KB
11
Indexable
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ObjectPool = require(ReplicatedStorage:WaitForChild("ObjectPool"))

local BulletsFolder = workspace:WaitForChild("Bullets")
local BulletTemplate = ReplicatedStorage.Assets:WaitForChild("Bullet") :: Part

-- Sadece template ve birkaç ayar veriyorsun
local bulletPool = ObjectPool.CreateInstancePool(BulletTemplate, {
    parent = BulletsFolder,
    minSize = 100,
    maxSize = 500,
    autoExpand = true,
    growthStep = 25,
})

local function fireBullet(origin: CFrame, velocity: Vector3)
    -- Spawn = Acquire + configure + (opsiyonel) auto-release
    bulletPool:Spawn(function(bullet: Part)
        bullet.CFrame = origin
        bullet.AssemblyLinearVelocity = velocity
        bullet.CanCollide = false
    end, 2) -- 2 saniye sonra otomatik Free
end
Editor is loading...
Leave a Comment