RemoteEvent ''Unable to cast value to Object'' error

Hi, how do i fix this error? I don’t understand what the error means.

RemoteEvent.OnServerEvent:Connect(function(player,Test)
    local httpService = game:GetService("HttpService")
	local url = "https://users.roproxy.com/v1/users"
	local data = httpService:GetAsync(url .. "/" ..Test) 
	data = httpService:JSONDecode(data)
	print(data.name)
	local user_name = data.name
	task.wait(5)
	RemoteEvent2:FireClient(user_name) -- this give error
	return data.name
end)

Can you show what the RemoteEvent does?

A RemoteEvent does not return Data, as it is a one way connection, use a RemoteFunction

RemoteEvent2.OnClientEvent:Connect(function(player, user_name)
	local yes_ban_user_gui = game.Players.LocalPlayer.PlayerGui.yes_ban_user
	yes_ban_user_gui.Enabled = true
	yes_ban_user_gui.Frame.user_name = user_name
end)

Oh I didn’t know that thanks. Then why is the remotefunction not always used instead of remotevent, so what is the purpose of remotevent?

You need to specify which cliend do you want to fire the event.
Try this:

RemoteEvent2:FireClient(player, user_name)

Thanks now working gui but return not working. So i need use RemoteFunction?