Jump to content

[Help]Information GUI


Om.

Recommended Posts

Debug Error:ERROR: ERPcore/information.lua:9: attempt to get length of global 'randomLabel' (a nil value)

Client:

informationLabels =   {  
'Press F1 for Rules Panel', 
'dministrators can be identified with [ADMIN] Tag on them.', 
'Dont break the rules, or else you will get punished.', 
'Be sure you visit our forums!'  
} 
  
function printInfo() 
local randomLabel = informationLabels[math.random(1, #randomLabel)] 
outputChatBox(randomLabel) 
end 
setTimer(printInfo, 1000, 1) 

Link to comment
informationLabels =   { 
'Press F1 for Rules Panel', 
'dministrators can be identified with [ADMIN] Tag on them.', 
'Dont break the rules, or else you will get punished.', 
'Be sure you visit our forums!' 
} 
  
function printInfo() 
local randomLabel = informationLabels[math.random(1, #informationLabels )] 
outputChatBox(randomLabel) 
end 
setTimer(printInfo, 1000, 1) 

Link to comment
local randomLabel = informationLabels[math.random(1, #randomLabel)] 

You don't have randomLabel declared anywhere in the script. And you're trying to get the length of it (using the # operator). Trying to get the length of a nil (which means nothing) value will not work. It's like trying to get the hair length of someone who is bald. It just doesn't work. :)

I'm assuming you wanted to pick a random text entry from informationLabels instead. So, just use the fix DTC12 provided. Use the length of informationLabels (which is a table that exists within your script).

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...