Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would i get the mouses position in a regular script?

Asked by 3 years ago

Im trying to make a players head orientation or rotation face where the mouse's positioned. i have this so far but it doesent work, and if i replace the head part and just say Print ("MousePosition") this works but it only does in local scripts. so i am mainly looking for putting a heads position or rotation twards the mouse. Btw here is the code

local Player = game.Players.LocalPlayer 
local Mouse = Player:GetMouse()
local MouseHitPos = Mouse.Hit
local MousePosition = MouseHitPos.p
local Name = Player.Name
local char = game.Workspace:FindFirstChild(Name)
char.Head.Orientation = MousePosition
0
MousePosition is souly on the client. You will need to send the mouse position, or desired head orientation, to the server. Use RemoteEvents https://developer.roblox.com/en-us/api-reference/class/RemoteEvent Benbebop 1049 — 3y

1 answer

Log in to vote
0
Answered by
tomekcz 174
3 years ago

I see your script and the solution i thought is to handle all mouse stuff at client side and send info using remotevent when u want

Ad

Answer this question