#Platformer dash lag
1 messages · Page 1 of 1 (latest)
** You are now Level 3! **
excellent gif i am stealing this
wait WHERE IS THE SCRIPT ????
Discord why 😔
Wait when was this so long bro.
Ok imma only send the needed parts
local function performDash()
if not RootPart or not Humanoid then return end
if isDashing or not canDashTimer then return end
if dashesLeft <= 0 then return end
-- 1. Consumption
dashesLeft = dashesLeft - 1
isDashing = true
canDashTimer = false
local dashDir = getDashDirection()
-- 2. State Change (Physics)
Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
-- 3. INSTANT FORCE APPLICATION (The Fix)
-- We set velocity IMMEDIATELY, we do not wait for the loop to start.
RootPart.AssemblyLinearVelocity = dashDir * DASH_SPEED
-- 4. Maintain Velocity Loop
local startTime = tick()
local connection
connection = RunService.Heartbeat:Connect(function()
local elapsed = tick() - startTime
if elapsed < DASH_DURATION then
-- Force velocity every frame to prevent drag
RootPart.AssemblyLinearVelocity = dashDir * DASH_SPEED
else
connection:Disconnect()
end
end)
task.wait(DASH_DURATION)
-- 5. Stop (Keep small momentum)
if RootPart then
RootPart.AssemblyLinearVelocity = dashDir * (DASH_SPEED * 0.2)
end
if Humanoid then
Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
isDashing = false
task.wait(DASH_COOLDOWN)
canDashTimer = true
end
-- --- 3. CRYSTAL LOGIC ---
local function activateCrystal(crystalPart)
-- Run in separate thread to prevent Impossible Yield
task.spawn(function()
if crystalPart.Transparency > 0.5 then return end
-- INSTANT REFILL
dashesLeft = MAX_DASHES```
Theres a bit more but its too long and its either mobile support or crystal effects