I'm trying to make a system where you can see everyone else's cursor on your screen. Here's the code I have now, and what is happening. (for the purposes of this question, only relevant code snippets will be provided.)

local MoveEvent = game:GetService("ReplicatedStorage").MoveCursor
MoveEvent.OnClientEvent:Connect(function(Player, X, Y) -- gets X and Y from the function below
	if script.Parent:FindFirstChild(Player.Name) then
		script.Parent:FindFirstChild(Player.Name).Position = UDim2.new(X, 0, Y, 0)
	end
end)

local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
Mouse.Move:Connect(function()
	local maxX, maxY = Mouse.ViewSizeX, Mouse.ViewSizeY
	
	local x = Mouse.X
	local y = Mouse.Y
	
	x = x / maxX
	y = y / maxY
	
	MoveEvent:FireServer(x, y) -- essentially just sends x and y to the function above
end)

https://imgur.com/a/zE9d33S

The image above shows that there is an offset between the real cursor, indicated in red, and the duplicated cursor, indicated in blue. This offset get's larger and larger the further down the screen it goes.

Clearly, the 36 pixels that take up the top of the screen's GUI are causing this offset, I just don't know how to tell it to ignore them. Please help!

1 comment

0

Nice, not a single attempt, this site is a joke.