local function Y(Y,w)if not w then local w=screenSpace.ScreenToWorld(Y.Position.X,Y.Position.Y,1)local s=game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(screenSpace.ScreenToWorld(Y.Position.X,Y.Position.Y,1))s=game.Workspace.CurrentCamera.CoordinateFrame.p-s local M=screenSpace.ScreenToWorld(Y.Position.X,Y.Position.Y,50)M=game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(M)*-1 if M.magnitude>900 then M=M.unit*900 end local x=Ray.new(s,M)local k,A=game.Workspace:FindPartOnRay(x,player.Character)if A then frame(A)end end end
-- Handling mobile calling the frame function
-- Function to bind to touch moved if player is on mobile
local function mobileFrame(touch, processed)
	-- Check to see if the touch was on a UI element. If so, we don't want to update anything
	if not processed then
		-- Calculate touch position in world space. Uses Stravant's ScreenSpace Module script
		-- to create a ray from the camera.
		local test = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1)
		local nearPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(
			screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1)
		)
		nearPos = game.Workspace.CurrentCamera.CoordinateFrame.p - nearPos
		local farPos = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 50)
		farPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(farPos) * -1
		if farPos.magnitude > 900 then
			farPos = farPos.unit * 900
		end
		local ray = Ray.new(nearPos, farPos)
		local part, pos = game.Workspace:FindPartOnRay(ray, player.Character)

		-- if a position was found on the ray then update the character's rotation
		if pos then
			frame(pos)
		end
	end
end
