-- Returns a character ancestor and its Humanoid, or nil

function UTIL.FindCharacterAncestor(subject)
	if subject and subject ~= Workspace then
		local humanoid = subject:FindFirstChild('Humanoid')
		if humanoid then
			return subject, humanoid
		else
			return UTIL.FindCharacterAncestor(subject.Parent)
		end
	end
	return nil
end

UTIL.AssetURL = 'http://www.roblox.com/asset/?id='


UTIL.TouchEnabled = game:GetService("UserInputService").TouchEnabled 
do
	local suceeded,_ =pcall(function() game.Workspace.CurrentCamera:GetPanSpeed() end)
	UTIL.CanCheckPanSpeed = suceeded
end


local DebrisService = Game:GetService('Debris')
local DebugPrintOffset = 0
function UTIL.Dprint(...)
	local line = ''
	for _, segment in pairs({...}) do
		line = line .. (line and ' ' or '') .. tostring(segment)
	end
	local gui = Instance.new('ScreenGui')
	local label = Instance.new('TextLabel')
	label.Text = line
	label.Size = UDim2.new(0.25, 0, 0.05, 0)
	label.BackgroundTransparency = 0.5
	label.Position = UDim2.new(0, 0, 0, DebugPrintOffset)
	label.TextWrapped = true
	label.Parent = gui
	DebrisService:AddItem(gui, 30)
	gui.Parent = script.Parent
	DebugPrintOffset = (DebugPrintOffset <= 600) and DebugPrintOffset + 30 or 0
end