i’m trying to make a debris effect and it is causing lag pls help
local total = math.random(2, 3)
for i = 1, total do
local part = part()
part.Parent = workspace
part.Position = ray.Position
local attachment0 = Instance.new("Attachment", part)
local linearV = Instance.new("LinearVelocity", attachment0)
local force = math.random(6, 10)
linearV.Attachment0 = attachment0
linearV.MaxForce = math.huge
linearV.VectorVelocity = dustPart.CFrame.UpVector * force
wait(0.15)
linearV:Destroy()
attachment0:Destroy()
end
do this on the client and instead of using :destroy use Debris:AddItem so you won’t wait 0.15 seconds each part. also it looks like you’re using rays, try to cap the ray unit size to somewhere around 6 or so