Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make the player walk backwards?

I have a game that I am working on currently, it's simply a fighting 2d game, though theres one flaw that makes this game look awful so far. The character when running backwards looks like he's running away. https://gyazo.com/efc7341acae241dab8f34412f250cf43

How would I make a script where he would walk backwards normally? I need it to make look like he's just walking backwards, not running away.

1 answer

I want to say you can do an animation of a person "Walking backwards" (On the spot) And then you can change the id of the script below on the walking id and use the animation id.

local Players = game:GetService("Players")

local function onCharacterAdded(character)
    local humanoid = character:WaitForChild("Humanoid")

    for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
        playingTracks:Stop(0)
    end

    local animateScript = character:WaitForChild("Animate")
    animateScript.run.RunAnim.AnimationId = "rbxassetid://616163682"        -- Run
    animateScript.walk.WalkAnim.AnimationId = "rbxassetid://616168032"      -- Walk
    animateScript.jump.JumpAnim.AnimationId = "rbxassetid://616161997"      -- Jump
    animateScript.idle.Animation1.AnimationId = "rbxassetid://616158929"    -- Idle (Variation 1)
    animateScript.idle.Animation2.AnimationId = "rbxassetid://616160636"    -- Idle (Variation 2)
    animateScript.fall.FallAnim.AnimationId = "rbxassetid://616157476"      -- Fall
    animateScript.swim.Swim.AnimationId = "rbxassetid://616165109"          -- Swim (Active)
    animateScript.swimidle.SwimIdle.AnimationId = "rbxassetid://616166655"  -- Swim (Idle)
    animateScript.climb.ClimbAnim.AnimationId = "rbxassetid://616156119"    -- Climb
end

local function onPlayerAdded(player)
    player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)

if you do not know how to do the animation here is what to do:

  1. Model the character and move the timeline to make the animation
  2. Once you did make sure to export it name it whatever and get the link (The numbers)
  3. Change the walking id to rbxassetid://(Your number)

4 comments

0

The only issue I have is that the player turns rather than just walking backwards, i want him to have the same movement but same direction at the same time while walking.

0

Oh, I see, what about you use: https://developer.roblox.com/en-us/api-reference/function/UserInputService/IsKeyDown for changing the settings when moved.

0

Though, how would I force it to move in 1 direction rather than turning around?

0

You would use the animation I put in the top, I think that would work, if not, I can't help, sorry.

This discussion is preserved as it was. New answers, comments, and votes are closed.