generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: This script I mean seams kinda long for what It does.

Previous Thread :: Next Thread 
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
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
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image