I am working on a number recognition system that is going to use a neural network that I am going to open source, but currently, it is very hard to draw something. Like for real. Try to draw the number one. I bet you 99% you won’t be able to do it.
Here is the GUI:
It goes in StarterGui (Obviously)
Here is the code the I am using to draw:
local parent = script.Parent
local players = game:GetService("Players")
local player = players.LocalPlayer
local mouse = player:GetMouse()
local mouseDown = nil -- The very first line of code that was ever written and this is what I feel when I think about the first thine of code that was ever written: https://www.youtube.com/watch?v=6eb_zYknomY ...
local camera = workspace:WaitForChild("Camera")
local viewPortSize = camera.ViewportSize
local pix3lFrame = parent:WaitForChild("DrawFrame")
local pix3ls = {}
local mouseXScaleOffset = 0
local mouseYScaleOffset = 0
for i, v in pairs(pix3lFrame:GetChildren()) do
if v:IsA("Frame") then
if v.Name == "Pixel" then
table.insert(pix3ls, v)
end
end
end
function draw()
while mouseDown do
game:GetService("RunService").Heartbeat:Wait()
local mouseX = mouse.X / viewPortSize.X
local mouseY = mouse.Y / viewPortSize.Y
for i, v in pairs(pix3ls) do
if math.abs(v.Position.X.Scale - (mouseX + mouseXScaleOffset)) < v.Size.X.Scale and math.abs(v.Position.Y.Scale - (mouseY + mouseYScaleOffset)) < v.Size.Y.Scale then
v.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
end
end
end
end
mouse.Button1Down:Connect(function()
mouseDown = true
print(mouse.X / workspace.CurrentCamera.ViewportSize)
spawn(function()
draw()
end)
end)
mouse.Button1Up:Connect(function()
mouseDown = false
print(mouse.X / workspace.CurrentCamera.ViewportSize)
end)
The more help I get, and the faster it is, then the faster this can get open sourced. So … Can someone please tell me how to keep this from happening?