#Afterimage effect prevents the player from moving while dashing

1 messages · Page 1 of 1 (latest)

urban badger
#

pretty sure its self explanatory

local P = game:GetService("Players")
local RunS = game:GetService("RunService")
local RS = game:GetService("ReplicatedStorage")

local OnDashRem: RemoteEvent = RS.OnDash

local function AfterimageEffect(character, transparency, lifetime)
    local function clonePart(part, transp)
        local clone = part:Clone()
        clone.Anchored = true
        clone.CanCollide = false
        clone.CanQuery = false
        clone.CanTouch = false
        clone.Transparency = transp
        clone.Parent = nil
        return clone
    end

    local partClones = {}

    for _, child in character:GetChildren() do
        if child:IsA("BasePart") or child:IsA("MeshPart") then
            if child.Name ~= "HumanoidRootPart" then
                local clone = clonePart(child, transparency)
                clone.CFrame = child.CFrame
                clone.Parent = workspace
                partClones[child] = clone
            end
        end
    end

    task.spawn(function()
        task.wait(lifetime)
        for _, clone in partClones do
            if clone and clone.Parent then
                clone:Destroy()
            end
        end
        for _, obj in workspace:GetChildren() do
            if obj:IsA("BasePart") and obj.Transparency == transparency then
                obj:Destroy()
            end
        end
    end)
end

OnDashRem.OnServerEvent:Connect(function(plr, hrp: BasePart, direction: Vector3)
    local BV = Instance.new("BodyVelocity", hrp)
    BV.MaxForce = Vector3.new(math.huge, 0, math.huge)
    BV.Velocity = direction * 50
    for time = 0, 5, 1 do
        task.wait(0.5/5)
        AfterimageEffect(hrp.Parent, 0.75, 0.5)
    end
    task.wait(0.5)
    BV:Destroy()
end)
#

Im 100% sure this has to do with the char just welding improperly

calm sleet
#

are you sure it's the afterimage?

urban badger
#

100%

#

cus without it the dashing works just fine

urban badger
urban badger
#

bump