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)