The function ‘Cosmetics Bullet’ needs outside ‘for’, but I have no idea how to write it. Your feedback on this would be appreciated
for _, part in pairs(game.ReplicatedStorage.bomb:GetDescendants()) do
if part:IsA("BasePart") and part.Name == 'Random' then
print(part)
local CosmeticBullet = part:Clone()
local CosmeticPartProvider = PartCacheModule.new(CosmeticBullet:Clone(), 100, CosmeticBulletsFolder)
end
end
local CastBehavior = FastCast.newBehavior()
CastBehavior.RaycastParams = CastParams
CastBehavior.MaxDistance = BULLET_MAXDIST
CastBehavior.HighFidelityBehavior = FastCast.HighFidelityBehavior.Default
CastBehavior.CosmeticBulletProvider = CosmeticPartProvider -- there is need a function in 'for' here.
CastBehavior.CosmeticBulletContainer = CosmeticBulletsFolder
CastBehavior.Acceleration = BULLET_GRAVITY
CastBehavior.AutoIgnoreContainer = false
What is the purpose of the for loop? What are you trying to achieve? I’m just guessing because I don’t know how FastCast works, but I think what you are trying to do is create multiple CastBehaviors for each type of “bomb”? It’s difficult to give any advice or suggestions without knowing what this code is supposed to do.