How would I make this ray script mobile-friendly?
I have this script for wands, I'm trying to make it mobile-friendly but to no success, if anyone can help it would be greatly appreciated.
01 | local tool = script.Parent |
02 | local UIS, Player, Camera = game:GetService( "UserInputService" ), game:GetService( "Players" ).LocalPlayer, workspace.CurrentCamera |
03 | local MP, MD = nil , nil |
05 | function GetMousePoint(X, Y) |
06 | local RayMag 1 = Camera:ScreenPointToRay(X, Y) |
07 | local NewRay = Ray.new(RayMag 1. Origin, RayMag 1. Direction * 2500 ) |
08 | local Target, Position = workspace:FindPartOnRayWithIgnoreList(NewRay, { Player.Character, workspace.FlyingSpells } ) |
09 | return { Target, Position } |
12 | local downEvent = function () |
16 | script.Parent.Comm:FireServer( true , MP [ 2 ] , MP [ 1 ] ) |
20 | UIS.InputBegan:Connect( function (input, pro) |
21 | if pro or script.Parent.Parent ~ = Player.Character then return end |
22 | if input.UserInputType = = Enum.UserInputType.Keyboard and input.KeyCode = = Enum.KeyCode.Q then |
25 | elseif (input.UserInputType = = Enum.UserInputType.MouseButton 1 or input.UserInputType = = Enum.UserInputType.Touch) and MP ~ = nil then |
33 | UIS.InputChanged:Connect( function (input, pro) |
34 | if input.UserInputType ~ = Enum.UserInputType.MouseMovement then return end |
36 | MP = GetMousePoint(input.Position.X, input.Position.Y) |
38 | UIS.InputEnded:Connect( function (input, pro) |
39 | if input.UserInputType ~ = Enum.UserInputType.Keyboard then |
40 | MP = GetMousePoint(input.Position.X, input.Position.Y) |
42 | if (input.UserInputType = = Enum.UserInputType.MouseButton 1 or input.UserInputType = = Enum.UserInputType.Touch) then |