So I have some code that should make it so when the player spawns in / respawns, they spawn with a tool in their hand with a custom holding animation script.
Problem: The holding animation does not visibly play upon spawning. However, the gun goes in the hand.
plrs.PlayerAdded:Connect(function(plr)
local char
plr.CharacterAdded:Connect(function(newChar)
char = newChar
local hum = char:WaitForChild("Humanoid")
local animator : Animator = hum:WaitForChild("Animator")
local newRifle = rifleModel:Clone()
newRifle.Parent = char
local parts = newRifle.Parts
local motor = parts.Motor
motor.Part0 = char:WaitForChild("Right Arm")
local track : AnimationTrack = animator:LoadAnimation(parts.holdAnim)
track:Play()
track.Looped = true
print(track.IsPlaying)
task.wait(1)
print(track.IsPlaying)
end)
end)
basically when the character arrives i put the tool in his hand which works
but my custom holding animation doesnt
also, the print statements for track.IsPlaying both print true, itās just that ingame my character isnāt using the animation
Notes:
- Game settings and animation are both r6 so itās not that
- āMotorā is a motor 6D
- The animation priority was set to āIdleā inside the animation editor
- the rifleModel is located in serverstorage and this is a server side script in server script service
Thanks to anyone who read the entire thing and is about to help me.
if you need any more info plz comment below