#Item idle animation quits working after death.

1 messages · Page 1 of 1 (latest)

tacit ridge
#

I have this plush item that plays an idle animation (as seen in first picture) and it works perfectly fine when equipped/unequipped, however, after death it has a 50/50 chance to just not work and it looks like the fourth picture below. I'm not exactly sure what the problem is.

covert eagle
tacit ridge
covert eagle
#

its alr

tacit ridge
#

i'm not familiar with that since i haven't used it yet

covert eagle
#

so

#

like

#
  -- the highlighted part 
end) ```
tacit ridge
#

OH

#

tysm let me try that out (and also write it down so i don't forget to learn that)

covert eagle
#

alr

#

so game.Players.PlayerAdded is when a player joins the game

#

and

#

player.CharacterAdded is when a character is added (so when it spawns into the game) so it runs when it resets

tacit ridge
#

ohhhhh

#

you know what that actually does make a lot of sense

covert eagle
#

game.Players.PlayerRemoving is when a player LEAVES the ga,e

tacit ridge
#

now that you explain it

covert eagle
#

game*

tacit ridge
#

i was familiar with player added but character added so that actually makes sense

covert eagle
#

mhm

#

if u run this is a server script

#

u need

#

to have

#

first

#

so then

#

u can access the player to make the player.CharacterAdded part

#

so its

covert eagle
#

exactly

covert eagle
#

if u want to add this feature as a local script

#

u can just make a local script under startercharacterscript

#

itll run whenever the player respawns

#

DONT USE THAT FOR NPCS, ONLY PLAYERS

tacit ridge
#

oh yeah i might've forgot to mention that this was the local script sorry if my wording was confusing

covert eagle
#

thats alr

#

i do that all the time too

tacit ridge
tacit ridge
covert eagle
#

is it working

#

???

tacit ridge
tacit ridge
covert eagle
#

alr

tacit ridge
#

it doesn't seem to have worked

#

no errors

covert eagle
#

uh oh

#

can u add print statements for the tool.Equipped and tool.Unequipped?

#

also do one for

#

characteradded

tacit ridge
#

yeah

#

gimem a sec

covert eagle
#

mhm

tacit ridge
#

still doesn't seem to be printing

#

no errors

covert eagle
#

its not printing?

#

if it doesnt print, that means error

#

yuh oh

tacit ridge
covert eagle
#

yea it isnt printing the statement

#

that means it isnt running properly

#

here lets try this

#

remove all of the code

#

and replace it with ur original

#

this one

#

then

#

wait no

#

wait nvm

#

take the code

#

drag it under startercharacterscripts

#

and then

#

replace

#

Tool = script.Parent

#

with

tacit ridge
#

wherever my tool is at right?

covert eagle
#

Tool = Player:WaitForChild("Backpack"):WaitForChild("KroyPlush")

covert eagle
#

so the code should look like this (gimme one sec to type)

tacit ridge
#

so it's in starterpack right now, but if i want it to be a purchasable item in the future, am i able to route it to the player's backpack?

#

Like since the local script and tool are seperated

covert eagle
#

local players = game:GetService("Players")
local plr = players.LocalPlayer

local backpack = plr:WaitForChild("Backpack")

local char = plr.Character or plr.CharacterAdded:Wait()

local hum = char:WaitForChildOfClass("Humanoid")
local animator = hum:WaitForChild("Animator")

local tool = backpack:WaitForChild("KroyPlush")

local idleAnim = script:WaitForChild("Idle")
local idleTrack = animator:LoadAnimation(idleAnim)

tool.Equipped:Connect:function()

   idleTrack:Play()
end)

tool.Unequipped:Connect(function()
  
   idleTrack:Stop()
end)```
#

oh shoot

#

remove the comment in the code

#

itll cause an error since its 2 lines lol

tacit ridge
#

lol got it 👍

covert eagle
#

clone*

tacit ridge
#

ok sounds good

#

wait

#

i put it in the wrong script lmao mb

#

my mistake

covert eagle
#

oh shoot im late

covert eagle
#

my fault, i got confused with the two

tacit ridge
#

k

#

seems to work so far i'm gonna test a bit with a friend

covert eagle
#

alr

tacit ridge
#

I can't get it to break so yeah i think it worked!

#

gonna try with more players since i didn't even notice it happening til i played with like 4 people let me try that rq

covert eagle
#

a;r

#

alr*

covert eagle
#

@tacit ridge

tacit ridge
#

yeah it worked!!!

#

tysm