so if i spawn a function and use task.wait in it, will it still throttle the entire scriopt? if so, how to avoid throttling?
Why not just use task.spawn()?
Use task.spawn or coroutine.wrap
because idk whats the differecte because nobody told me
so i can do task.spawn function?
Use task.spawn, as Spawn() is depercated and not the current supported method
The task library is better. That’s just all you need to know.
It doesn’t have throttling or as much throttling
It’s not deprecated, there’s just a better way to do it which is basically half deprecated?
You sure? I just read the roblox docs which says:
“This function is based on the fastSpawn pattern rather than being a replacement for the deprecated global spawn function.”
We have established that task.spawn is better than spawn, so there is no need to argue as you both agree.
Yup, the task library works exactly like the original ones except it doesn’t throttle as much.
task.wait(n)
task.spawn(function)
task.delay(secondstowait, function) --basically task.wait in a task.spawn at the start
--the other ones here
I’m not arguing, I’m asking. Idc if its better or not. I care about if in 5 years from now it will be gone.
so what amm i supposed to use now?!?!?
Use task.spawn instead of spawn.
so just like this?
function BounceEffect(Model)
spawn(function()
--Clone the model, so that we can add the effect on the clone
local BounceModel = Model:Clone()
BounceModel.Parent = Model.Parent
--Loop through the children of the model to change their color and tween them
for a,b in ipairs(BounceModel:GetDescendants())do
if not b:IsA("BasePart") then b:Destroy() end
--Change the color and material to the desired effect
b.Material = Enum.Material.Plastic
b.Color = Color3.new(1, 1, 1)
--For the effect to not interfere with the player, make it uncollidable
b.CanCollide = false
b.CanTouch = false
b.Anchored = true
game.TweenService:Create(b,TweenInfo.new(0.5,Enum.EasingStyle.Bounce),{Transparency = 1,Size = b.Size * 1.5}):Play()
end
--wait for everything to finish and clean up the model
task.wait(0.5)
BounceModel:Destroy()
end)
end
script.RECIEVER.Event:Connect(BounceEffect)
Add task. before your spawn. That’s it.
so i can do many at same time without script throttled?
Just replace that with task.spawn(function()
Absolutely no changes needed.
Thank you for this very relevant reply to this discussion.