- What do you want to achieve? Keep it simple and clear!
The drawing dots being drawn accurately in the mouse’s position
- What is the issue? Include screenshots / videos if possible!
https://gyazo.com/fb799581aafcea0f706bf3ce756b5369
the drawing dots are not accurate to the mouse position, the accuracy also changes depending on what side you draw for some reason.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried loooking for a fix, couldn’t find any.
The script that fires the remote event, and the important one because it fires out the position.
local mouse = game.Players.LocalPlayer:GetMouse()
local remoteevent = game.ReplicatedStorage.Draw
local x
local y
local pressed = false
mouse.Button1Down:Connect(function()
pressed = true
end)
mouse.Button1Up:Connect(function()
pressed = false
end)
mouse.Move:Connect(function()
if mouse.Target then
local model = mouse.Target:FindFirstAncestorOfClass("Model")
if model then
if model:FindFirstChild("Drawing") then
x = mouse.X
y = mouse.Y
if pressed == true then
local frame = model.Drawing.SurfaceGui.Frame
local color = script.Colour.Value
local pos = UDim2.new(-0.2, x, 0, y)
remoteevent:FireServer(color, pos)
end
end
end
end
end)
The script that gets the fired values and converts them into the drawing dots:
local remoteevent = game.ReplicatedStorage.Draw
local frame = script.Parent.SurfaceGui.Frame
remoteevent.OnServerEvent:Connect(function(plr, color, pos)
local dot = Instance.new("Frame")
dot.Name = "Dot"
dot.Parent = frame.dots
dot.BackgroundColor3 = color
dot.Size = UDim2.new(0, 7, 0, 5)
dot.BorderSizePixel = 0
dot.Position = pos
end)