Hey, my aim is to make sure that when the player presses one they play an animation and then change the default idle animation.
There are a few issues though, if I change the default idle animations before or after the animation has been played, the played will still do the default idle animation until I move and go back into another idle animation. So basically the old idle animation is not stopping and the new one is not overriding it.
Then I tried to stop all animations from playing before playing the main animation and the same thing happens only there is no idle animation until you move and go back into an idle animation.
Then I tried to stop all animations and after the main animation, start the idle animation manually, which led to the player just being stuck in the idle animation even when moving.
Then I tried changing the animations priority to core and that kinda worked, but not really. The animation got messed up and the hands and legs aren’t in the right positions I suspect my idle core animation is overlapping with all the over-core animations. I couldn’t find a way to change the weight of my idle core animation so it’s lower than the walking/running animation and therefore it all is just mushed up.
Should I just make a script that changes all the default animations and set’s the priorities or is there another way?
The code:
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local userIService = game:GetService("UserInputService")
local humanoid = character:FindFirstChild("Humanoid")
local animations = game:GetService("ReplicatedStorage"):WaitForChild("Animations")
local animator = humanoid:FindFirstChild("Animator")
local animateScript = character:WaitForChild("Animate")
local combatStartAnimationTrack = animator:LoadAnimation(animations.CombatStart)
local combatIdleAnimation = animations.CombatIdle
local combatIdleAnimationTrack = animator:LoadAnimation(animations.CombatIdle)
userIService.InputBegan:Connect(function(input)
local idleDb = false
if input.KeyCode == Enum.KeyCode.One and not idleDb then
for i, v in pairs(humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
animateScript.idle.Animation1.AnimationId = combatIdleAnimation.AnimationId
animateScript.idle.Animation2.AnimationId = combatIdleAnimation.AnimationId
local idleAnimationTrack2 = animator:LoadAnimation(animateScript.idle.Animation1)
idleAnimationTrack2.Priority = Enum.AnimationPriority.Core
combatStartAnimationTrack:Play()
idleAnimationTrack2:Play()
idleDb = true
end)
robloxapp-20241129-1736125.wmv (840.9 KB)