Make Your Own Dash Script in Minutes! | Roblox Essentials #6

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 9

  • @xxneweraxx7422
    @xxneweraxx7422 День тому

    nice tutorial, do add guard clauses and for a complementary thing, you could perhaps just include those elements in the server storage (or well, replicatedstorage i guess depending on where you want latency) and copy them to your humanoidrootpart, in order to avoid setting the options again and again

  • @dave10101
    @dave10101 Місяць тому +1

    W vid

  • @Munkivr
    @Munkivr Місяць тому +2

    Make it in minutes. 30. Make it in half an hour.

    • @SolepsusYT
      @SolepsusYT  Місяць тому +1

      Well after this video you should be able to make one yourself in minutes. Explaining the logic behind my code was a majority of the video

    • @Munkivr
      @Munkivr Місяць тому

      @@SolepsusYT oh ok

  • @hyperblox7809
    @hyperblox7809 3 дні тому +1

    outdated but still works with some changes, ty

  • @Tettzz
    @Tettzz Місяць тому +2

    local uis = game:GetService("UserInputService")
    local RS = game:GetService("ReplicatedStorage")
    local player = game:GetService("Players").LocalPlayer
    local char = player.Character or player.CharacterAdded:Wait()
    local hum = char:WaitForChild("Humanoid")
    local Root = char:WaitForChild("HumanoidRootPart")
    local StaminaManager = require(game.ReplicatedStorage.StmHandlerFolder.StaminaManager)
    local canRoll = true
    local maxStamina = 100
    local cam = game.Workspace:WaitForChild("Camera")
    local rollDepletionAmount = 30
    local function rollMotion(direction, animtrack)
    animtrack:Play() --play animation
    script.DashSound:Play()
    local BV = Instance.new("BodyVelocity")
    BV.MaxForce = Vector3.new(30000, 0, 30000)
    BV.Parent = Root
    local canLoop = true

    task.spawn(function()
    task.wait(0.18) --animation length
    canLoop = false
    end)
    while true do
    if canLoop == false then break end

    local c1 = Vector3.new(cam.CFrame.X, Root.CFrame.Y, cam.CFrame.Z)
    local c2 = cam.CFrame * CFrame.new(0, 0, 2)
    local c3 = Vector3.new(c2.X, char.HumanoidRootPart.CFrame.Y, c2.Z)
    local DD = CFrame.new(c1, c3)*CFrame.Angles(0, math.rad(direction), 0)
    BV.Velocity = DD.lookVector * 60 --change number for higher speed

    task.wait(0.04) --CFrame update speed
    end
    BV:Destroy()
    end
    uis.InputBegan:Connect(function(key)
    if key.KeyCode == Enum.KeyCode.Q then
    local stamina = StaminaManager.getStamina()
    --check if: character loaded, player has enough stamina, debounce, player is moving
    if char and Root and stamina >= rollDepletionAmount and canRoll == true and hum.MoveDirection.Magnitude > 0 then
    canRoll = false
    StaminaManager.updateStamina(-rollDepletionAmount, player) --subtract stamina
    --check if player uses ShiftLock
    if uis.MouseBehavior == Enum.MouseBehavior.LockCenter then
    if uis:IsKeyDown(Enum.KeyCode.W) then --dash forward
    local direction = -180
    local animtrack = hum.Animator:LoadAnimation(script.FrontDash)
    rollMotion(direction, animtrack)
    elseif uis:IsKeyDown(Enum.KeyCode.S) then --dash backwards
    local direction = 0
    local animtrack = hum.Animator:LoadAnimation(script.BackDash)
    rollMotion(direction, animtrack)
    elseif uis:IsKeyDown(Enum.KeyCode.A) then --dash to the left
    local direction = -90
    local animtrack = hum.Animator:LoadAnimation(script.LeftDash)
    rollMotion(direction, animtrack)
    elseif uis:IsKeyDown(Enum.KeyCode.D) then --dash to the right
    local direction = 90
    local animtrack = hum.Animator:LoadAnimation(script.RightDash)
    rollMotion(direction, animtrack)
    end
    else --if ShiftLock is off then do only front dash
    if uis:IsKeyDown(Enum.KeyCode.W) then
    local direction = -180
    local animtrack = hum.Animator:LoadAnimation(script.FrontDash)
    rollMotion(direction, animtrack)
    elseif uis:IsKeyDown(Enum.KeyCode.S) then
    local direction = 0
    local animtrack = hum.Animator:LoadAnimation(script.FrontDash)
    rollMotion(direction, animtrack)
    elseif uis:IsKeyDown(Enum.KeyCode.A) then
    local direction = -90
    local animtrack = hum.Animator:LoadAnimation(script.FrontDash)
    rollMotion(direction, animtrack)
    elseif uis:IsKeyDown(Enum.KeyCode.D) then
    local direction = 90
    local animtrack = hum.Animator:LoadAnimation(script.FrontDash)
    rollMotion(direction, animtrack)
    end
    end
    task.wait(1.5) --cooldown
    canRoll = true
    end
    end
    end)

    • @SolepsusYT
      @SolepsusYT  Місяць тому +1

      unnecessarily long, and something like stamina should probably not be locally stored