local function playanimation(player)
	if playerloaded.hasloaded(player) then
		pcall(function()
			local animator = player.Character.Humanoid.Animator
			local animation
			for i, v in pairs(serverstorage.Celebrations:GetChildren()) do
				for index, anim in pairs(v:GetChildren()) do
					if anim.Name == player.leaderstats2.SelectedAnim.Value then
						animation = anim
						break
					end
				end
			end
			if animation then
				animator:LoadAnimation(animation):Play()
			end
		end)
	end
end


4 comments

0

When a player selects there animation it will save in leaderstats and will play when they score this is a snitbit of the code

0

remove the pcall and look for errors in console

0

this is only a snippet this isnt just for animations

0

Remove '.Animator' line 4.