Animation won't play on NPC or Player

Hello,

I have had very bad experience with animation tracks in my history and this trouble is no different from other struggles. The animation will not play at all even though it is set to Action. Any help will be hugely appreciated

Player Script
local UIS = game:GetService("UserInputService")

local plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local char = plr.Character or plr.CharacterAdded:Wait()
local clickTimes = 0
local DELAY_TIME = 0.5
local db = false
UIS.InputBegan:Connect(function(i,gpe)
	if i.UserInputType == Enum.UserInputType.MouseButton1 and not db then
		print("Mouse click has begun.")
		db = true
		local humanoid = char:WaitForChild("Humanoid")
		local animator = humanoid:WaitForChild("Animator")
		local animFolder = workspace:WaitForChild("M1 combo")
		clickTimes = math.clamp(clickTimes+1,1,4)
		print(clickTimes)
		local anim = animFolder["Click " .. clickTimes]
		local track = animator:LoadAnimation(anim)
		track.Priority = Enum.AnimationPriority.Action
		track:Play()
		print(clickTimes)
		if clickTimes == 4 then
			clickTimes = 0
		end
		task.wait(0.5)
		db = false
	end
end)
NPC Script
local animFolder = workspace:WaitForChild("M1 combo")
local isPlayingAnim = false
local animTime = 2
local loopTime = 0
--[[
all the print statements work.. but the animations wont play?
]]
while task.wait(animTime) do
	print("Works here ?")
	if not isPlayingAnim then
		print("Works here ? at not isPlayingAnim")
		isPlayingAnim = true
		local animator = workspace.Dummy:WaitForChild("Humanoid"):WaitForChild("Animator")
		loopTime = math.clamp(loopTime+1,1,#animFolder:GetChildren())
		local anim = animFolder["Click " .. loopTime]
		local track = animator:LoadAnimation(anim)
		track.Priority = Enum.AnimationPriority.Action
		track:Play() 
		if track.IsPlaying then
			print("Is Playing Track of Name: " .. track.Name)
		end
		print(track.Name)
		if loopTime == #animFolder:GetChildren() then
			loopTime = 0
			print("Works: " .. tostring(loopTime))
		end
		task.wait(animTime)
		print("works.." .. tostring(animTime)) -- 2, also works
		isPlayingAnim = false
		print("Set isPlayingAnim to " .. tostring(isPlayingAnim))
	end
end

Do you own the animation you are using? If you don’t own the animation then the animation won’t play.

Well, my friend made it and I invited him to the game as an editor so does it still work as that?

I don’t believe the team create allows others to see animations, you can ask your friend for the file or the rig with the animation loaded and export it to Roblox yourself.

Ah, ok. I’ll try asking him. I’ll mark this as the solution for now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.