I am currently working on a game with the default R6 character. The problem/issue I ran into is that the default R6 animate script is really messy and extra code I don’t need. What also happens is that some times the players movement animations we made don’t play. So I currently I am wondering how I can create my own movement using the humanoid?
Couldnt you just make a copy of the Animate script and put it in StarterCharacterScripts or something?
or, something like this?
local ffc,wfc = game.FindFirstChild,game.WaitForChild
game.Players.PlayerAdded:Connect(function(noob)
noob.CharacterAdded:Connect(function(noob2)
wfc(noob2 , 'Humanoid')
local abc = ffc(noob2 , 'Animate')
if abc then
abc:Destroy()
end
myscript.Parent = noob2
end)
end)
Hello. Are you trying to find a better way to use your animations? I would suggest just scrapping the rblx default animation script and using your own. You could have yours in Server storage then delete the Animate default script and replace it with yours by cloning.
Thats what I mean, but I dont know where to start. With the code I mean.
yes but I want to create my own movement, as in with keys.
In my custom Animate scripts I usually use Humanoid.MoveDirection to determine whether or not the player is idle or moving rather than using user input service. I usually set up with a funciton for loading animations and clearing them. Here is an example.
local char = script.Parent
local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local function loadSingularAnimation(anim,priority,speed)
local animationToLoad = animator:LoadAnimation(anim)
animationToLoad.Priority = priority
animationToLoad:Play()
if speed then
animationToLoad:AdjustSpeed(speed)
end
end
local function clearAnimationArray(array)
for _,v in pairs(humanoid:GetPlayingAnimationTracks()) do
if table.find(array,v.Name) then
v:Stop()
end
end
end
local function clearAllAnimations()
for _,v in pairs(humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
end
local humanoidDict = {
["WalkingCalled"] = function(old,new)
if char:GetAttribute("IsRunning") ~= true and char:GetAttribute("IsIdle") == true then
char:SetAttribute("IsIdle",false)
coroutine.wrap(loadSingularAnimation)(script.Walk,Enum.AnimationPriority.Movement)
end
end,
["JumpingCalled"] = function()
if char:GetAttribute("IsJumping") == false then
char:SetAttribute("IsJumping",true)
coroutine.wrap(loadSingularAnimation)(script.Jump,Enum.AnimationPriority.Movement,1.2)
end
end,
["JumpingEnded"] = function()
char:SetAttribute("IsJumping",false)
end,
[Vector3.new(0,0,0)] = function()
local clearArray = {"Walk","Run"}
char:SetAttribute("IsIdle",true)
coroutine.wrap(clearAnimationArray)(clearArray)
end,
["RunningCheck"] = function()
if char:GetAttribute("IsRunning") == true and char:GetAttribute("IsAiming") == false then
coroutine.wrap(loadSingularAnimation)(script.Run,Enum.AnimationPriority.Movement,1.4)
humanoid.WalkSpeed = runningSpeed
elseif char:GetAttribute("IsRunning") == false then
local clearArray = {"Run"}
humanoid.WalkSpeed = defaultWalkSpeed
coroutine.wrap(clearAnimationArray)(clearArray)
end
end,
}
Attributes are really helpful in my case since I’m using custom rigs. You can do this for yours as well.
Note: I cleared the animations on the humanoid but that should actually be done on the animator as any other method is deprecated
How do I run this correctly? Like as in calling the functions when needed to play the animation.