Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

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

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.