Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to remove these particles? Having trouble

Asked by 4 years ago

Ok so i'm trying to remove those particles that are in the player but i'm finding it unusually hard could someone please help me?

timeReq = 1
function recursive(part, tab)
    for i, m in pairs(part:GetChildren()) do
        recursive(m, tab)
        if m:IsA("BasePart") then

        table.insert(tab, m)
        end
    end
end
function endTeleport(pos, partsToLerp, transparencies, char)
    local e = {}
    e.transparency = 1
    while e.transparency > 0 do
        e.transparency = math.max(e.transparency - wait()/timeReq, 0)
        applyTransparencies(partsToLerp, transparencies, e.transparency)
    end
    teleporting = false
end
function applyTransparencies(tab1, tab2, lerp)
    for i, m in pairs(tab1) do
        local div = lerp
        local s = 1
        local e = tab2[i]
        m.Transparency = ((s - e) * div) + e
    end
end
function beginTeleport(pos, char)
    teleporting = true
    local partsToLerp = {}
    recursive(char, partsToLerp)
    local transparencies = {}
    for i, m in pairs(partsToLerp) do
        transparencies[i] = m.Transparency
        local ef = Instance.new("ParticleEmitter")
        ef.Parent = m
        ef.Texture = "rbxgameasset://Images/purepng.com-smokesmokefireflamecandle-1411527094842ft0pp"
        ef.Rate =  15
        ef.Speed = NumberRange.new(0,0)
        ef.Size = NumberSequence.new(1,1)
        ef.Lifetime = NumberRange.new(.5,1)
        local c1 = Color3.new(0,0,0)
        local c2 = Color3.new(0,0,0)
        ef.Color = ColorSequence.new(c1,c2)
        ef.Transparency = NumberSequence.new(.3,.4)
        ef.RotSpeed = NumberRange.new(300,300)
    end
    local e = {}
    e.transparency = 0
    while e.transparency < 1 do
        e.transparency = math.min(e.transparency + wait()/timeReq, 1)
        applyTransparencies(partsToLerp, transparencies, e.transparency)
    end
    local torso = char:WaitForChild("HumanoidRootPart")

    char.HumanoidRootPart.CFrame = CFrame.new(pos, torso.Position)
    endTeleport(pos, partsToLerp, transparencies, char)
end
teleporting = false
script.Parent.MouseDown.OnServerEvent:connect(function(plr)
    if not teleporting then
        local mouse = script.Parent.GetMouseProperties:InvokeClient(plr)
        plr.Character:WaitForChild("HumanoidRootPart")
        beginTeleport(mouse.Hit.p, plr.Character)
    end
end)

1 answer

Log in to vote
0
Answered by 4 years ago

[MAYBE WORKS] Change ef.rate at 38 line to 0.000001 or 0.

Ad

Answer this question