Ahoy, I am Eluates. I am currently working on a personal project that involves a custom rig, therefore needing a custom walking system; I want the walking system to have a side step to it to make the automatic Roblox walking more realistic and immersive. I do not know the way to approach this. I have not done much in the core walking system of games in the past; anything helps!
When a player’s character loads, a LocalScript
called “Animate” loads in. If you want to change the walk animation, this code should work as a LocalScript
in StarterPlayer.StarterCharacterScripts
:
local character = script.Parent
local animate = character:WaitForChild("Animate")
local walkValue = animate:WaitForChild("walk")
local walkAnim = walkValue:WaitForChild("WalkAnim")
walkAnim.AnimationId = "rbxassetid://ANIMATION_ID_HERE"
And to revert back to the default walk animation, you can run this code:
local character = script.Parent
local animate = character:WaitForChild("Animate")
local walkValue = animate:WaitForChild("walk")
local walkAnim = walkValue:WaitForChild("WalkAnim")
walkAnim.AnimationId = "http://www.roblox.com/asset/?id=913402848"
how do you want this said “side step” to work? do you want it binded to a key or something? anyway
if you want to make your own core walking system you will need to make and export an animation for each state
– walking
– idle
– jumping
–and your side stepping
you can then export these to roblox and get the animation ids for them (if you need help with how to do that ask)
you will then put the IDs into “animation” instances in which ever place suits best for you, then put the animation ID into the “AnimationId” property
the first step to animating something via script would be defining all the animations
you’ll see why we use “LoadAnimation” in a second
so for you when you want to run forward or jump ect you should use user input service to detect when one of these keys are pressed and animate accordingly
local UIS = game:GetService("UserInputService")
local Char = Player.Character
local IdleAnimation = script.Parent:WaitForChild("IdleAnimation", 10)
local LoadIdleAnimation = Char.Humanoid:LoadAnimation(IdleAnimation)
local RunningAnimation= script.Parent:WaitForChild("RunningAnimation", 10)
local LoadRunningAnimation = Char.Humanoid:LoadAnimation(RunningAnimation)
UIS.InputBegan:Connect(function(input, Proccess)
if input.KeyCode == Enum.KeyCode.W then
LoadRunningAnimation:Play()
end
end)
UIS.InputEnded:Connect(function(input, Proccess)
if input.KeyCode == Enum.KeyCode.W then -- if w is no longer pressed
LoadRunningAnimation:Stop()
LoadIdleAnimation:Play() -- if this is a low priority animation technically you dont
end -- need to play this because the higher level animations will just override it
end) -- and you just need to play it once so its always playing when nothing else is
im not sure if this was any help to you but feel free to ask questions if you have any
I want something like this, watch when he walks sideways: https://www.youtube.com/watch?v=2BKnh2n4w6I
to accomplish this you are going to need to lock the character in a shift lock state, when player.playeradded(player), and then animate a side step and activate it when D or W is pressed, he does the looking around thing by taking the look vector of the camera and changing the cframe of the head and torso or just head accordingly.
Take a look into Inverse Kinematics
this post might be helpful for you