#I created a skill that involves aiming with the mouse, but idk how to adapt it for mobile devices
1 messages · Page 1 of 1 (latest)
Also for the consoles one
ReplicationFolder.RemoteFunction.OnClientInvoke = function(Data)
if Data.Goal == "GetMousePoint" then
local Device = shared.PlayerDevice()
if Device == "PC" then
return Mouse.Hit.Position
end
end
end
This is how i get the position of the aim on pc
** You are now Level 1! **
No
What?

hm
Its not position if u want that you van send ray instead
Or use mouse.Target, but it will be the position of the part that is beeing hit
And raycast get exact position of where you aim
raycast with the camera?
nevermind
Then put the camera.CFrame.Position in argument 1 and camera.CFrame.LookAngle in the 2nd argument
:Raycast() returns the ray so you can asset it to a variable with different data like: Raycast.Instance, Raycast.Position or Raycast.Distance
yeah but
I’m on phone rn, but if I was on pc I would make script
No

ok i will use the raycast
I think it's the best option anyways.
Thx!
ReplicationFolder.RemoteFunction.OnClientInvoke = function(Data)
if Data.Goal == "GetMousePoint" then
local Device = shared.PlayerDevice()
if Device == "PC" then
return Mouse.Hit.Position
elseif Device == "Mobile" or Device == "Console" then
local Raycast = workspace:Raycast(Camera.CFrame.Position, Camera.CFrame.LookVector)
if Raycast then
return Raycast.Position
else
return Camera.CFrame.Position + Camera.CFrame.LookVector * 10
end
end
end
end
** You are now Level 2! **