|
| 04 Oct 2014 12:21 PM |
When you click the 'Draw' button, it makes a gui where you click and it resizes it until you let go. Than if you click clear it removes all guis, and when you click remove button, it removes one gui.
BUut it seams kinda long for only doing those things.
local drawbutton=script.Parent:WaitForChild('Draw') local clearbutton=script.Parent:WaitForChild('Clear') local removebutton=script.Parent:WaitForChild('Remove') local F=require(script.Parent.Parent:WaitForChild('ModuleScript')) local mouse=game.Players.LocalPlayer:GetMouse() local guis={} local gui=nil local mousedown local drawing mouse.Button1Down:connect(function() mousedown=true end) mouse.Button1Up:connect(function() mousedown=false gui=nil end) drawbutton.MouseButton1Down:connect(function() if not drawing then drawing=true drawbutton.Text='Click Anywhere to start drawing' mouse.Button1Down:connect(function() if not gui then gui=F.Draw('TextLabel',script.Parent,{0,mouse.X,0,mouse.Y},{0,0,0,0},0,{0,0,0}) table.insert(guis,gui) mouse.Move:connect(function() if gui and mousedown then gui.Size=UDim2.new(0,mouse.X-gui.Position.X.Offset,0,mouse.Y-gui.Position.Y.Offset) end end) else gui=nil end end) end end) drawbutton.MouseButton1Down:connect(function() if drawing then drawing=false drawbutton.Text='Click To Draw' end end) clearbutton.MouseButton1Down:connect(function() for _,i in pairs(guis)do i:Destroy() end end) removebutton.MouseButton1Down:connect(function() guis[#guis]:Destroy() end) |
|
|
| Report Abuse |
|
|
| 04 Oct 2014 12:46 PM |
| It could be made more efficient and/or use less lines, but code needs to be very specific in what it tells the computer to do. When you're doing something which seems simple, instructions can add up fast. |
|
|
| Report Abuse |
|