Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

algorithm in drawing with textlabel?

Asked by
pwx 1581 Moderation Voter
5 years ago

I'll try as be as brief as possible so I don't bore you to death with all this reading.

I am currently trying to create an algorithm that detects letters, numbers and shapes that I am drawing within' the UI.

An example:

If I were to type the letter 'L' like so - https://gyazo.com/c6b824523175ae62c6caee191a4f4764.gif

In the output, it would print the letter 'L', obviously.

Shape type of situation if I were to draw a circle, it would print in the output 'Circle.'

The code I currently have is this:

local mouse = game.Players.LocalPlayer:GetMouse()
local frame = script.Parent.ScreenGui.Frame

local holding = false

spawn(function()
    while wait() do
        if holding then
            if not frame:FindFirstChild(mouse.X..'/'..mouse.Y) then
                local txt = script.TextLabel:Clone()
                txt.Parent = frame
                txt.Name = mouse.X..'/'..mouse.Y
                txt.Position = UDim2.new(0, mouse.X - 3, 0, mouse.Y - 3)
            end
        end
    end
end)

mouse.Button1Down:connect(function()
    holding = true
end)

mouse.Button2Down:connect(function()
    frame:ClearAllChildren()
end)

mouse.Button1Up:connect(function()
    holding = false
end)

As you can see, I use a TextLabel with the Zindex of 1 to create a 'drawing mark' if you will.

If any of you could help me out I'd be totally grateful, thanks in advanced.

0
Bump pwx 1581 — 5y

Answer this question