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 MOVE an animation?

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

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

3 comments

0

Where do I put this script? At the bottom of my script?

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.

0

Could I just use CFrame or Vector3? Because this is a bit complex, I'm not a full-fledged scripter yet.

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