algorithm in drawing with textlabel?
Asked by
pwx 1581
6 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:
01 | local mouse = game.Players.LocalPlayer:GetMouse() |
02 | local frame = script.Parent.ScreenGui.Frame |
09 | if not frame:FindFirstChild(mouse.X.. '/' ..mouse.Y) then |
10 | local txt = script.TextLabel:Clone() |
12 | txt.Name = mouse.X.. '/' ..mouse.Y |
13 | txt.Position = UDim 2. new( 0 , mouse.X - 3 , 0 , mouse.Y - 3 ) |
19 | mouse.Button 1 Down:connect( function () |
23 | mouse.Button 2 Down:connect( function () |
24 | frame:ClearAllChildren() |
27 | mouse.Button 1 Up:connect( function () |
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.