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: Problem with this script...

Previous Thread :: Next Thread 
Optiics is not online. Optiics
Joined: 05 Mar 2013
Total Posts: 1619
21 Jul 2013 09:18 PM
I made this script which contains a function to make text labels. Each text label is named accordingly from "a" to "h". Each text label is suppose to be 0.5 pixels below the other.

you will get what I mean:

script.Parent.Access.MouseButton1Down:connect(function()

function console(letter, act, position)

local letter = Instance.new("TextLabel",script.Parent.Console)
letter.Name = act
letter.Position = position
letter.Font = "ArialBold"
letter.FontSize = "Size18"
letter.TextColor3 = Color3.new(255/255, 255/255, 255/255)
letter.TextXAlignment = "Left"
end

console(a, "a", UDim2.new(0.03,0,0.95,0))
console(b, "b", a.Position + UDim2.new(0,0,0.05,0))
console(c, "c", b.Position + UDim2.new(0,0,0.05,0))
console(d, "d", c.Position + UDim2.new(0,0,0.05,0))
console(e, "e", d.Position + UDim2.new(0,0,0.05,0))
console(f, "f", e.Position + UDim2.new(0,0,0.05,0))
console(g, "g", f.Position + UDim2.new(0,0,0.05,0))
console(h, "h", g.Position + UDim2.new(0,0,0.05,0))






Here is an Output error I'm getting:

22:17:49.433 - Players.Player1.PlayerGui.ControlPanel.LocalScript:173: attempt to index global 'a' (a nil value)
22:17:49.436 - Script "Players.Player1.PlayerGui.ControlPanel.LocalScript", Line 173
22:17:49.439 - stack end
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 09:38 PM
Oh, remove letter from it and put a = console(...) b = console(...) etc
Report Abuse
TheSecondk7 is not online. TheSecondk7
Joined: 23 Dec 2012
Total Posts: 196
21 Jul 2013 09:52 PM
Gah, I am really new to scripting. That looks like japanese to me. I do think he is right though.
Report Abuse
Optiics is not online. Optiics
Joined: 05 Mar 2013
Total Posts: 1619
21 Jul 2013 10:06 PM
The output is referring to this line:

console(b, "b", a.Position + UDim2.new(0,0,0.05,0))
Report Abuse
Optiics is not online. Optiics
Joined: 05 Mar 2013
Total Posts: 1619
21 Jul 2013 10:35 PM
nothng?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 10:54 PM
I told you...
Report Abuse
Optiics is not online. Optiics
Joined: 05 Mar 2013
Total Posts: 1619
21 Jul 2013 11:27 PM
told me what? It made no sense
Report Abuse
expressmyself is not online. expressmyself
Joined: 19 Apr 2011
Total Posts: 1768
21 Jul 2013 11:28 PM
He said remove the argument letter and make a variable instead

Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Jul 2013 11:31 PM
Why have a letter parameter when you're just going to override it? It would error because the the letter is nil.
Report Abuse
Optiics is not online. Optiics
Joined: 05 Mar 2013
Total Posts: 1619
21 Jul 2013 11:35 PM
Guys, that isn't even the problem.

I'm still getting this error:

00:34:37.488 - Players.Player1.PlayerGui.ControlPanel.LocalScript:173: attempt to index global 'a' (a nil value)
00:34:37.491 - Script "Players.Player1.PlayerGui.ControlPanel.LocalScript", Line 173
00:34:37.493 - stack end


Here is the script, I defined the line that is causing the error:



script.Parent.Access.MouseButton1Down:connect(function()

function console(act, position)

local letter = Instance.new("TextLabel",script.Parent.Console)
letter.Name = act
letter.Position = position
letter.Font = "ArialBold"
letter.FontSize = "Size18"
letter.TextColor3 = Color3.new(255/255, 255/255, 255/255)
letter.TextXAlignment = "Left"
end

a = console("a", UDim2.new(0.03,0,0.95,0))
b = console("b", a.Position + UDim2.new(0,0,0.05,0)) -- LINE 173 ERROR
c = console("c", b.Position + UDim2.new(0,0,0.05,0))
d = console("d", c.Position + UDim2.new(0,0,0.05,0))
e = console("e", d.Position + UDim2.new(0,0,0.05,0))
f = console("f", e.Position + UDim2.new(0,0,0.05,0))
g = console("g", f.Position + UDim2.new(0,0,0.05,0))
h = console("h", g.Position + UDim2.new(0,0,0.05,0))
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 11:40 PM
You need to return the letter

Add

return letter

To just before the end
Report Abuse
Optiics is not online. Optiics
Joined: 05 Mar 2013
Total Posts: 1619
21 Jul 2013 11:43 PM
@not

Thanks, it worked.

Can you explain why returning the letter worked tho?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 11:46 PM
Because it told the script to set a to the return of letter from the function.

Think of it as this: I ask you to go and make me a cake. You go, make the cake (the body of the function) and bring it back to me (the return)

#cannotexplain
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Jul 2013 11:47 PM
What's the point of even assigning it to a variable?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
21 Jul 2013 11:49 PM
You can then do stuff to it for the lulz.
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