Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I MOVE an animation?

Asked by 8 years ago
wait(2) 

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local humanoid = player.Character.Humanoid --Humanoid
local s = humanoid:LoadAnimation(game.StarterPack.PwrSlide.Animation)

Mouse.KeyDown:connect(function(key)
if key:lower() == "c" and humanoid then
    s:Play()
    humanoid.WalkSpeed = 29 
wait(1)
    humanoid.WalkSpeed = 14
wait(1)
    humanoid.WalkSpeed = 1
    s:Stop()
    humanoid.WalkSpeed = 16
wait(5)
end
end)

Anyone ever play that new Star Wars game on roblox or NRPG, and when you double tap W, S, A, or D, the player does an animation, but it moves them side-ways or forward? Like, if you double-tap W (On NRPG) you do a front flip, moving you forward. Not just a front flip in place. What I have here is a Slide animation, it speeds up the walkspeed of a player but I don't like it. I was wondering how would I make the player move forward "x" amount of studs (Or whatever). I assume Vector3 is needed in this, right?

NO I do not want people to double-tap C. Just once, and it makes the slide animation while moving the player forward automatically.

1 answer

Log in to vote
0
Answered by 8 years ago

Your animation would be one where the actual animation just puts the player in the slide position, not actually moving them. Then it would be a simple case of smoothly moving the character forward, using the torso or something.

For example (this may not be the most efficient way to do this):

function slide()
    slideAnim:Play()
    for i = 1,200 do -- 2 second slide animation
        char.Torso.CFrame = char.Torso.CFrame + Vector3.new(0.025,0,0) -- this would move the character 5 studs forward in total
        wait(0.01)
    end
end

If you have any other problems, PM me on ROBLOX (username is EmeraldSlash).

~TDP

0
Where do I put this script? At the bottom of my script? james24dj 90 — 8y
0
It's the function that makes the character slide. Put it at the top of the script, but below where 'char' is defined. Make the KeyDown event call 'slide()' when the proper key is pressed. TheDeadlyPanther 2460 — 8y
0
Could I just use CFrame or Vector3? Because this is a bit complex, I'm not a full-fledged scripter yet. james24dj 90 — 8y
Ad

Answer this question