local event = script.Parent.Parent.Event local cursor = script.Parent.Cursor local function OnEvent(player) print(player) local mouse = player:GetMouse() print(mouse) while true do cursor.Position = UDim2.new(0,mouse.X,0,mouse.Y) end end event.OnServerEvent:Connect(OnEvent)
I did everything right, ClassName is "script", but :GetMouse doesn't works, it just gives nil value, I want to make a cursor on SurfaceGui
You cannot pass the GetMouse instance to the server, it can only be done on a LocalScript.
For further information please see: https://scriptinghelpers.org/questions/54579/anyways-to-grab-getmouse-from-local-script-to-server-script
You can, however, pass the Mouse.Hit and Mouse.Target and other properties.
If you see this as a direct answer to your question, consider making this an 'accepted answer'