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

Allowing the player to roll?

Asked by 4 years ago

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.

0
Just use an animation. cmgtotalyawesome 1418 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

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.

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. mistrustfully 0 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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

Answer this question