#Gun Idle Animation isnt working

83 messages · Page 1 of 1 (latest)

mystic bolt
#

bruh

#

basically

#

i have a code which works perfectly except for the fact that the idle animation isnt working

#

the firing animation for the gun is working fine

#

i even messed around with the code and the result was the idle animation was playing non stop even when i unselected the gun/tool

#

and the firing animation didnt work

#

then i put the code back to normal

#

so what should i do so that the animation of idle is below the priority of the firing one?

#

just know i published the idle animation to roblox in priority action3

native field
#

where is the code

mystic bolt
#

the code is fine

#

but i will send it anyway

mystic bolt
# native field where is the code
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

local tool = script.Parent


local idleAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.IDle)
local shootAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.Fire)


tool.Equipped:Connect(function()

    game.ReplicatedStorage.ConnectM6D:FireServer(tool.BodyAttach)
    
    char.Torso.ToolGrip.Part0 = char.Torso
    char.Torso.ToolGrip.Part1 = tool.BodyAttach


    idleAnim:Play()
end)

tool.Unequipped:Connect(function()

    game.ReplicatedStorage.DisconnectM6D:FireServer()

    idleAnim:Stop()
end)



tool.Activated:Connect(function()

    shootAnim:Play()
end)```
native field
#

if the script is fine then it isnt a scripting problem

#

;-

#

and you should load animation on animator instead of humanoid

native field
#

Humanoid.Animator:LoadAnimation

#

instead o Humanoid:LoadAnimation

mystic bolt
#

ooh

#

lemme try

#

local idleAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.IDle)
local shootAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.Fire)

#

ok so here

wooden dew
#

yeah

mystic bolt
#

local idleAnim = char:WaitForChild("Humanoid")Animator:LoadAnimation(script.IDle)
local shootAnim = char:WaitForChild("Humanoid")Animator:LoadAnimation(script.Fire)

#

like this?

wooden dew
#

add . before Animator

#

it will throw error

mystic bolt
#

i did that

#

ok now so erm

#

the idle animation still isnt working.

#

but the firing is working fine

#

wat is bro typing

wooden dew
#
local tool = script.parent
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChild("Humanoid")
local Animator = Humanoid.Animator :: Animator

local Anim = script.IDle

local IdleAnim = Animator:LoadAnimation(Anim)


tool.Equipped:Connect(function()
  IdleAnim:Play()
end)

tool.Unequipped:Connect(function()
  IdleAnim:Play()
end)
#

i do prefer make it like this

#

this is my way to get the animator and load an idle anim

mystic bolt
#

hmm

#

lemme try

wooden dew
#

for Humanoid i use FindFIrstChild()

mystic bolt
wooden dew
#

the animation Instance have the animation id pasted in?

wooden dew
#

like rbxassetid://123456

mystic bolt
#

yeah

#

wait lemme show smth else to u

wooden dew
#

ight

#

my recommendation is re-type the code

mystic bolt
odd pawnBOT
#

studio** You are now Level 3! **studio

mystic bolt
#

this is what happens when i delete

#

game.ReplicatedStorage.ConnectM6D:FireServer(tool.BodyAttach)

char.Torso.ToolGrip.Part0 = char.Torso
char.Torso.ToolGrip.Part1 = tool.BodyAttach
mystic bolt
#

the idle animation is stuck for whole time even when the tool is unequipped AND the firing button is completely not working

wooden dew
#

i've a question

mystic bolt
#

aight

wooden dew
#

the code is inside a localscript

#

or script

mystic bolt
#

local script

wooden dew
#

aight bet

#

isually

#

we do attach the models or stuff like that in the server

#

coz that will be just for the client user

#

then just delete the

#

keep the fireserver

mystic bolt
#

k

wooden dew
#

in the script where it will receive the fireserver, attach the tool or idk what you're trying

#

this

#

and if not working

#

then re-type code

mystic bolt
#

i will try in a few min

mystic bolt
#

is it because the idle animation is set to a particular priority?

#

i will do all this later

#

i gtg

#

i just added a reloading animation and it works perfectly when i press R

mystic bolt
#

@wooden dew I DID IT

#

IT WORKS

#

i did smth else

#

but ty

wooden dew
#

nice