Hi. I have this whiteboard that i am making currently for a game. I need it to work like this: The client gets mouse location on surfacegui. What i mean by this is what the udim2 is of the position of the mouse on an surfacegui. You will see what i mean later.
Then the client sends this info to the server, which makes the "dot" used to draw on the whiteboard.
Basically i have problems converting the mouse position to an udim2 position on an surfacegui.
What the problem is is that the position of the mouse converted into udim2 on a surfacegui is not accurate. Ive already figured out how to do the interaction between client and server. Take a look:
The red do is where it is supposed to draw, and the black dot is where it draws. I have tried several solutions to solve this problem. I tried using a button and using the MouseMoved function, but for some reason that doesnt work. Like i said, the system works, the cursor position to surfacegui udim2 does not work.
And YES, I have tried using WorldToScreenPoint but THAT does not even work!
Local script:
local c = false
local board = script.Parent.Adornee
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local remote = script.Parent:FindFirstChild("MakeDot") or script.Parent:WaitForChild("MakeDot")
mouse.Move:Connect(function()
if c then --This works, please ignore this
print("ok")
remote:FireServer(Vector2.new(mouse.X, mouse.Y), mouse.Target)
end
end)
mouse.Button1Down:connect(function()
c = true
end)
mouse.Button1Up:connect(function()
c = false
end)
Server script:
local remote = script.Parent:FindFirstChild("MakeDot") or script.Parent:WaitForChild("MakeDot")
remote.OnServerEvent:Connect(function(player, pos, target)
local config = script.Parent.Adornee.Parent.Configuration
local billboard = script.Parent.Adornee.SurfaceGui
if target then --This works, please ignore this
if target.Name == "WhiteBoard" then --This works, please ignore this
if config.Owner.Value == player then --This works, please ignore this
local image = Instance.new("ImageLabel", billboard.Frame.Container)
image.Position = UDim2.new(0, pos.X, 0, pos.Y)
end
end
end
end)

4 comments
Can someone answer this?
So the red dot is not where the mouse cursor at?
yes
@Xapelize The red dot is where it is supposed to go