Hi guys,
I would like to ask for your help with this problem “Get data from server to client”
Ex:
Server
TriggerClientEvent(‘event’, -1, ‘Hello World!’)
Client
RegisterNetEvent(‘event’)
AddEventHandler(‘event’, function(str)
String = str
end)
Print(String) —this is problem <————
I want to ‘print string’, how do I do it?
Thank you, guys
Does your print have a reason to be outside of the event ?
Server
TriggerClientEvent('event', -1, 'Hello World!')
Client
RegisterNetEvent('event')
AddEventHandler('event', function(str)
local String = str
print(String)
-- or
-- print(str)
end)
1 Like
Yes, i want print out side event. Can i do that?
D4NE
July 9, 2021, 6:29pm
4
Yes. but print is triggered while String is not defined?
D4NE
July 9, 2021, 6:30pm
5
Everything outside of the event is triggered when the script starts
1 Like
d0p3t
July 10, 2021, 5:06pm
6
We are not closing this. We are going to reset the original question and you should share the solution. This forum is not just for you. People with the same issue/question need to be able to find a solution first before having to pollute the forum with another topic