local UIS = game:GetService(“UserInputService”) local Players =…
- User
local UIS = game:GetService(“UserInputService”) local Players = game:GetService(“Players”) local Player = Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local RootPart = Character:WaitForChild(“HumanoidRootPart”) local Humanoid = Character:WaitForChild(“Humanoid”) :: Humanoid local Animations = game:GetService(“ReplicatedStorage”):WaitForChild(“Animations”):WaitForChild(“Player”)
local Camera = workspace.CurrentCamera
local BV = Instance.new(“BodyVelocity”)
local Settings = { Lifetime = 0.15; DashVelocity = 55; Cooldown = 3; }
local Keycodes = { [Enum.KeyCode.E] = true; [Enum.KeyCode.ButtonL1] = true; }
local Animations = { Forward = Humanoid:LoadAnimation(Animations:WaitForChild(“FrontDash”)), Backward = Humanoid:LoadAnimation(Animations:WaitForChild(“BackDash”)), Left = Humanoid:LoadAnimation(Animations:WaitForChild(“LeftDash”)), Right = Humanoid:LoadAnimation(Animations:WaitForChild(“RightDash”)), }
local MovementKeys = { [Enum.KeyCode.W] = “Forward”, [Enum.KeyCode.A] = “Left”, [Enum.KeyCode.S] = “Backward”, [Enum.KeyCode.D] = “Right” }
local function playDashAnimation() local direction for key, anim in pairs(MovementKeys) do if UIS:IsKeyDown(key) then direction = anim break end end
if direction then Animations[direction]:Play() end end
local function f() local Now = workspace:GetServerTimeNow() local DashCooldown = Character:GetAttribute(“DashCooldown”) or 0 if DashCooldown > Now then return end Character:SetAttribute(“DashCooldown”, Now + Settings.Cooldown)
local NewBV = BV:Clone() NewBV.MaxForce = Vector3.new(1e5, 1e5, 1e5) NewBV.P = 1250
local Direction = Humanoid.MoveDirection if Direction.Magnitude == 0 then Direction = RootPart.CFrame.LookVector end local CamP0 = Camera.CFrame.LookVector local RelativeDirection = CFrame.lookAt(CamP0, CamP0 + Direction).LookVector
local currentYVelocity = RootPart.Velocity.Y / 1.5 NewBV.Velocity = Vector3.new(RelativeDirection.X, 0, RelativeDirection.Z) * Settings.DashVelocity + Vector3.new(0, currentYVelocity, 0) NewBV.Parent = RootPart playDashAnimation() task.delay(Settings.Lifetime, function() NewBV:Destroy() end) end
UIS.InputBegan:Connect(function(InputObject: InputObject, SunkInput: boolean) if SunkInput then return end if not Keycodes[InputObject.KeyCode] then return end
f() end)
Humanoid.Jumping:Connect(function() local NewBV = RootPart:FindFirstChildOfClass(“BodyVelocity”) if NewBV then local currentYVelocity = RootPart.Velocity.Y NewBV.Velocity = Vector3.new(NewBV.Velocity.X, currentYVelocity, NewBV.Velocity.Z) end end)
the momentum is added only after the dash. i want this to be added as soon as the player jumps mid-dash.
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.