Because:
GetPlayerName(ID) exists server-sided and client-sided but takes different IDs as parameters.
On the server side you can use the source (ServerID), but on client side you have to use the ClientID.
The ServerID & ClientID of a player don’t always have to be the same…
So, when you use “from” it is the ServerID, which is only used server-sided and causes this problem you have:
To fix this, there are two options. First get the name on the server side and give it over to the client or convert the ServerID to the ClientID with this Native: GetPlayerFromServerId(ServerID) (But if I recall right, it wasn’t working for me, so better use option one)
Option One:
server.lua
RegisterServerEvent("SyncTweets")
AddEventHandler('SyncTweets', function(inputText)
TriggerClientEvent('DisplayTweet', -1, inputText)
end)
AddEventHandler('chatMessage', function(from, name, message)
if message == "/t" then
CancelEvent()
TriggerClientEvent("TweetAlert", GetPlayerName(from))
end
end)