0% found this document useful (0 votes)
58 views2 pages

Roblox Dash and Double Jump Script

The document contains a Lua script for a game that implements dash and double jump mechanics. It defines variables for dash speed, duration, cooldowns, and manages player input for executing these actions. The script resets jump counts when the player lands and allows for a maximum of two jumps with a cooldown between them.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views2 pages

Roblox Dash and Double Jump Script

The document contains a Lua script for a game that implements dash and double jump mechanics. It defines variables for dash speed, duration, cooldowns, and manages player input for executing these actions. The script resets jump counts when the player lands and allows for a maximum of two jumps with a cooldown between them.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

-- // CONFIG

local dashSpeed = 100 -- Velocidade do dash


local dashDuration = 0.2 -- Duração do dash
local dashCooldown = 1 -- Cooldown entre os dashs
local jumpCooldown = 0.2 -- Delay entre pulos
local maxJumps = 2 -- Total de pulos (1 normal + 1 extra)

-- // VARIÁVEIS
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local player = [Link]


local char = [Link] or [Link]:Wait()
local humanoid = char:WaitForChild("Humanoid")
local root = char:WaitForChild("HumanoidRootPart")

local jumpsUsed = 0
local canDash = true
local lastJumpTime = 0

-- // FUNÇÃO: Resetar pulos quando toca o chão


[Link]:Connect(function(old, new)
if new == [Link] or new ==
[Link] then
jumpsUsed = 0
end
end)

-- // FUNÇÃO: Verifica entrada de tecla


[Link]:Connect(function(input, gameProcessed)
if gameProcessed then return end

-- DASH
if [Link] == [Link] and canDash then
canDash = false

local direction = [Link]


local bodyVelocity = [Link]("BodyVelocity")
[Link] = direction * dashSpeed
[Link] = [Link](1e5, 0, 1e5)
[Link] = root

[Link](dashDuration, function()
bodyVelocity:Destroy()
end)

[Link](dashCooldown, function()
canDash = true
end)
end

-- PULO DUPLO
if [Link] == [Link] then
local now = tick()
if now - lastJumpTime < jumpCooldown then return end
lastJumpTime = now

if humanoid:GetState() == [Link] and jumpsUsed


< maxJumps - 1 then
humanoid:ChangeState([Link])
jumpsUsed += 1
end
end
end)

You might also like