Tonitoni
|
  |
| Joined: 14 Mar 2009 |
| Total Posts: 6429 |
|
|
| 12 Jul 2012 07:06 AM |
local Head=script.Parent local Model=script.Parent.Parent
function OnClick()
local Num1=math.random(1,9) local Num2=math.random(1,9) local Num3=math.random(1,9) local Num4=math.random(1,9) local Num5=math.random(1,9)
local Number=Num1 .. Num2 .. Num3 .. Num4 .. Num5
Model.Name=Number
end
Head.ClickDetector.MouseClick:connect(onClick) |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 07:07 AM |
Well what seems to be the problem? Any output? ;)
-Nick |
|
|
| Report Abuse |
|
|
Tonitoni
|
  |
| Joined: 14 Mar 2009 |
| Total Posts: 6429 |
|
|
| 12 Jul 2012 07:12 AM |
14:11:34 - attempt to call a nil value 14:11:34 - Disconnected event because of exception |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 07:12 AM |
Head.ClickDetector.MouseClick:connect(OnClick)
Function calls are case sensitive; try that. |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 07:14 AM |
It was something like: String expected; got number.
tostring(Num1 .. Num2 .. Num3 .. Num4 .. Num5)
|
|
|
| Report Abuse |
|
|
Tonitoni
|
  |
| Joined: 14 Mar 2009 |
| Total Posts: 6429 |
|
|
| 12 Jul 2012 07:15 AM |
| It worked! Thanks triston! |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 07:15 AM |
What triston said, or try adding a table.
-Nick |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 07:16 AM |
| No worries, I'm glad that I could be of assistance. |
|
|
| Report Abuse |
|
|
Tonitoni
|
  |
| Joined: 14 Mar 2009 |
| Total Posts: 6429 |
|
|
| 12 Jul 2012 07:16 AM |
| Although I don't see the difference between what I wrote and you wrote triston. It just worked for some wierd reason lol. |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 07:18 AM |
Head.ClickDetector.MouseClick:connect(onClick)
See the lowercase o in onClick?
Your function name is OnClick, so that o needs to be capitalized. :) |
|
|
| Report Abuse |
|
|
Tonitoni
|
  |
| Joined: 14 Mar 2009 |
| Total Posts: 6429 |
|
| |
|
|
| 12 Jul 2012 07:25 AM |
What are you making? :o
-Nick |
|
|
| Report Abuse |
|
|
Tonitoni
|
  |
| Joined: 14 Mar 2009 |
| Total Posts: 6429 |
|
|
| 12 Jul 2012 07:27 AM |
| Just doing some tutorials :P |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 07:29 AM |
Setting the random seed will also ensure that you can a different random each time the script is ran.
math.randomseed(tick())
You could put this at the top of the script or if you put it before each math.random call the numbers would be, well, more random. |
|
|
| Report Abuse |
|
|