Why is this not working? Please help me.
function MyTestTextFunction ( )
if ( not text01 ) then
display = textCreateDisplay ( ) -- create a new display, store the reference in a variable called display
for index, player in ipairs ( getElementsByType ( "player" ) ) do
textDisplayAddObserver ( display, player ) -- add an observer to it
end
text01 = textCreateTextItem ( "Report all the bugs you find with /report.", 0.01, 0.20 ) -- create a text item
text02 = textCreateTextItem ( "Some text", 0.01, 0.20 ) -- create a text item
text03 = textCreateTextItem ( "Some text", 0.01, 0.20 ) -- create a text item
textItemSetScale ( text01, 1.5)
textItemSetScale ( text02, 1.5)
textItemSetScale ( text03, 1.5)
any = math.random(1,3)
if (any == 1) then
textDisplayAddText ( display, text01 ) -- Add the text item to the text display
setTimer (
function ( )
textDestroyTextItem ( text01 )
text01 = nil
end
,20000, 1
)
elseif (any == 2) then
textDisplayAddText ( display, text02 ) -- Add the text item to the text display
setTimer (
function ( )
textDestroyTextItem ( text02 )
text02 = nil
end
,20000, 1
)
elseif (any == 3) then
textDisplayAddText ( display, text03 ) -- Add the text item to the text display
setTimer (
function ( )
textDestroyTextItem ( text03 )
text03 = nil
end
,20000, 1
)
end
end
setTimer ( MyTestTextFunction, 15000, 0 )
addEventHandler ( "onResourceStart", resourceRoot, MyTestTextFunction )
Error message: WARNING: Loading script failed: notice\notice.lua:49: 'end' expected (to close 'function' at line 1) near ''