Hello, I am trying to create some gun system, I have made some animations for it but it dosen’t work so I was just playing with it and I created this really simple script:
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then
warn("Humanoid not found")
return
end
local animator = humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator", humanoid)
local animationId = "rbxassetid://135181025371195"
local animation = Instance.new("Animation")
animation.AnimationId = animationId
local function playAnimation()
local track = animator:LoadAnimation(animation)
track.Looped = true
track.Priority = Enum.AnimationPriority.Action
track:Play()
end
playAnimation()
it’s really simple and should just play that one single animation but it dosen’t work for some reason
any advice what could be wrong?