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

Allowing the player to roll?

I spent all day trying to figure out how I could make the code to allow the player to roll like in SwordBurst 2 (https://www.roblox.com/games/659222129) I know I have to use some kind of Body Mover, yet I don't know what does what or how to calculate what direction the player needs to move in.

I know how to use UserInputService so having it run when a key is pressed isn't a problem.

1 comment

0

Just use an animation.

2 answers

You need to use an animation to make the character roll. Make your own or take one.

A LocalScript is required for it to work.

local playerCharacter = game.Players.LocalPlayer.Character
local humanoid = playerCharacter:WaitForChild("Humanoid")
local anim = script.Animation --Change to animation location

humanoid:LoadAnimation(anim):Play()

The playerCharacter variable stores the PlayerCharacter location. The humanoid variable stores the location of the character's humanoid. The anim variable stores the Animation's location. Change it to where your animation object is. (You need to insert an animation object in the workspace or as a child of ANYTHING and just make sure the script can locate it. Insert the animation's ID that you chose into the animation object and you're done. If you renamed your animation object to anything else then write the name of the animation object.) Finally, the last line tells the humanoid as you see the variable being called and the LoadAnimation function is also called. Into the parentheses of the LoadAnimation function, the anim variable's name is in it. Then, the Play() function well... plays the animation. Hope that helps.

1 comment

0

Ofcourse I could use an animation, but I'm trying to move the player forward in the direction they are facing. Animations don't affect the HumanoidRootPart, which is what I'm trying to move.

Nevermind, I created a Shield effect to make my games PVP better, it works pretty good.

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