I’m working on a script, and I don’t know how to get the player’s mouse in a server script. GetMouse() only works on the client, anyone know how to do this?
local rs = game:GetService("RunService")
local seat = game.Workspace.VehicleSeat
local player
local gun = workspace.Gun
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
player = game.Players:FindFirstChild(seat.Occupant.Parent.Name)
print(player.Name)
end)
while true do rs.Stepped:Wait()
local gunPos = gun.Position
local mousePos = nil --Need mouse
gun.CFrame = CFrame.new(rootPos, Vector3.new(mousePos.X, mousePos.Y, mousePos.Z))
end
You would have to send the information you want from the player’s mouse through a RemoteEvent to the server; you can’t get the mouse from the server side
i dont know if you already found it out, but know that when you do a loop with 0 seconds delay with wait() of sending informations with remote event, your roblox studio will crash when you test it, cuz its laggy to use a remote event, and its worse when you like spawm it in loop.
i dont know what you should do instead, but remote looping remote event will not work.