#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)

tropic glen
#

I need a way to put a aim in others devices

#

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

spiral dawnBOT
#

studio** You are now Level 1! **studio

prime axle
#

No

tropic glen
prime axle
#

No u dont understand no

#

No know no now

tropic glen
prime axle
#

No

#

Its no how to get position

#

Just use camera.CFrame.LookAngle

tropic glen
#

hm

prime axle
#

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

tropic glen
#

raycast with the camera?

prime axle
#

Bruh are we fr

#

Workspace:Raycast

tropic glen
#

nevermind

prime axle
#

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

tropic glen
#

yeah but

prime axle
#

I’m on phone rn, but if I was on pc I would make script

prime axle
tropic glen
#

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

spiral dawnBOT
#

studio** You are now Level 2! **studio