Erielvictor / Meus-projetos

2 stars 0 forks source link

Running #10

Open Erielvictor opened 1 year ago

Erielvictor commented 1 year ago
local UserInput = game:GetService("UserInputService")
local player = game:GetService('Players').LocalPlayer

local velocidadeAndando = 16
local velocidadeRunning = 30
local velocidadeBerserk = 50

local character = game.Workspace:WaitForChild(player.Name)

function running(input, processing)
    if not processing then
        if input.UserInputType == Enum.UserInputType.Keyboard then
            local tecla = input.KeyCode
            if tecla == Enum.KeyCode.LeftShift then
                player.Character.Humanoid.WalkSpeed = velocidadeRunning

            end
        end

    end
end

function andando(input, processing)
    if not processing then
        if input.UserInputType == Enum.UserInputType.Keyboard then
            local tecla = input.KeyCode
            if tecla == Enum.KeyCode.LeftShift then
                player.Character.Humanoid.WalkSpeed = velocidadeAndando

            end
        end

    end
end

function Berserk(input, processing)
    if not processing then
        if input.UserInputType == Enum.UserInputType.Keyboard then
            local tecla = input.KeyCode
            if tecla == Enum.KeyCode.C then
                player.Character.Humanoid.WalkSpeed = velocidadeBerserk

            end
        end

    end
end

function BerserkStop(input, processing)
    if not processing then
        if input.UserInputType == Enum.UserInputType.Keyboard then
            local tecla = input.KeyCode
            if tecla == Enum.KeyCode.C then
                player.Character.Humanoid.WalkSpeed = velocidadeAndando

            end
        end

    end
end

UserInput.InputBegan:Connect(running)
UserInput.InputBegan:Connect(Berserk)
UserInput.InputEnded:Connect(BerserkStop)
UserInput.InputEnded:Connect(andando)

The berserk part are opcional, It was just a test :)