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

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

    local httpService = game:GetService("HttpService")
	local url = ""
	local data = httpService:GetAsync(url .. "/" ..Test) 
	data = httpService:JSONDecode(data)
	local user_name =
	RemoteEvent2:FireClient(user_name) -- this give error

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

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?