--[[
	
	Plays an animation on humanoid/character/player. Returns {animationTrack, animation}
	
	Functions.Animation(
		id,						<-- |REQ| 	Animation ID
		instance,				<-- |REQ|	Player/character/humanoid		
	)
	
--]]



return function(id, parent)
	local humanoid
	
	--- Get humanoid
	if parent.ClassName == "Humanoid" then
		humanoid = parent
	elseif parent:FindFirstChildOfClass("Humanoid") then
		humanoid = parent:FindFirstChildOfClass("Humanoid")
	elseif parent.ClassName == "Player" then
		humanoid = parent.Character:FindFirstChild("Humanoid")
	end
	
	--- Play animation
	if humanoid then
		local animation = Instance.new("Animation")
		animation.AnimationId = "rbxassetid://" .. id
		--
		local track = humanoid:LoadAnimation(animation)
		track:Play()
		--
		return track
	end
end
