#task.wait() waiting forever in module script

4 messages · Page 1 of 1 (latest)

turbid cloud
#

in both of these functions, it's supposed to wait for some time before executing the rest, but it just waits forever in both. the module script is in the player's character and the script that uses it is in an object that the player touches


function module.HitParticles(color)
    for i = 0, Random.new():NextInteger(8, 12), 1 do
        local butterPart = game:GetService("ReplicatedStorage").ButterParticle:Clone()
        butterPart.CFrame = script.Parent.HumanoidRootPart.CFrame
        butterPart.Color = color
        butterPart.Parent = workspace
        
        script.Parent.HumanoidRootPart.Splat.Color = ColorSequence.new(color)
        script.Parent.HumanoidRootPart.Splat.Enabled = true
        task.wait(0.2)
        script.Parent.HumanoidRootPart.Splat.Enabled = false
    end
end

function module.ApplySlowness(duration)
    local originalSpeed = script.Parent:FindFirstChildOfClass("Humanoid").WalkSpeed
    script.Parent:FindFirstChildOfClass("Humanoid").WalkSpeed /= 2
    task.wait(duration)
    script.Parent:FindFirstChildOfClass("Humanoid").WalkSpeed = originalSpeed
end

return module
charred acorn
#

put modulescript inside the workspace not from player.Character

reef wren
turbid cloud
#

i ended up using something else ot's fine