try this,
Client:
function registering()
if ( source == GUIEditor_Button[4] ) then
local g_textR = guiGetText( GUIEditor_Edit[3] )
local g_textR2 = guiGetText( GUIEditor_Edit[4] )
local g_textR3 = guiGetText( GUIEditor_Edit[5] )
if g_textR ~= "" and g_textR2~="" and g_textR3~="" then --check if the field actually have something
triggerServerEvent("g_textToRegister",localPlayer, g_textR, g_textR2, g_textR3)
end
end
end
addEventHandler("onClientGUIClick",guiRoot, registering)
Server:
function g_textToRegister( user, password, g_textR3)
if password == g_textR3 then
local account = addAccount ( user, password )
else
triggerClientEvent(client,"confirmError",root)
return --automatically end the script if the password doesn't match
end
if logIn ( client, account, password) then --you used account2 instead of account
outputChatBox ( "successfully registered, welcome ".. getPlayerName( client ), client, 255, 255, 0 , true )
randomModel = math.random( 26, 37 )
setElementModel ( client, randomModel )
else
triggerClientEvent(client,"registerEroor",root)
end
end
addEvent("g_textToRegister", true)
addEventHandler("g_textToRegister",root, g_textToRegister)