Remote event is not being fired

Hello. I am making a trading system, as you may know, trading system require a lot of client-server communication, It all went fine until I figured out a remote event isn’t being fired. I’ve tried to print something when the button is clicked, it works, I tried to print something in the beggining of the remote event handler, but it did not print it. Here are my codes:

LocalScript:

local button = script.Parent;

local function on_Click()	
	local player = game.Players.LocalPlayer;
	
	local requestSender = string.split(script.Parent.Parent.Parent.TextLabel.Text, " ")[1]
	
	script.Parent.Parent.Parent.Parent.Enabled = false
	
	player.PlayerGui.TradePanel.Enabled = true;

	player.PlayerGui.Inventory.Enabled = false;

	player.PlayerGui.Trading.Enabled = false;

	player.PlayerGui.Around.Inside.FirstOffer.OffererUsername.Value = player.Name

	player.PlayerGui.Around.Inside.SecondOffer.OffererUsername.Value = requestSender

	player.PlayerGui.TradePanel.Around.Inside.FirstOffer.Offerer.Text = string.upper(player.Name).. "'S OFFER"

	player.PlayerGui.TradePanel.Around.Inside.SecondOffer.Offerer.Text = string.upper(requestSender).. "'S OFFER"
	
	script.Parent.Parent.Parent.Parent.Enabled = false
	
	game.ReplicatedStorage.TradeRemotes.AcceptTrade:FireServer(script.Parent.Parent.RequestSender.Value)
end;

button.MouseButton1Click:Connect(on_Click)

ServerScript:

local remoteEvent = game.ReplicatedStorage.TradeRemotes.AcceptTrade;

local function server_Event(player, requestSender)
	print("Fired.")
	
	for _, v in ipairs(game.Players:GetChildren()) do
		if string.upper(v.Name) == string.upper(requestSender) then
			v.PlayerGui.TradePanel.Enabled = true
			
			v.PlayerGui.TradePanel.Around.Inside.FirstOffer.Offerer.Text = string.upper(requestSender).. "'S OFFER"
			
			v.PlayerGui.TradePanel.Around.Inside.SecondOffer.Offerer.Text = string.upper(player.Name).. "'S OFFER"
			
			v.PlayerGui.Inventory.Enabled = false;
			
			v.PlayerGui.Trading.Enabled = false;
		end
	end
end;

remoteEvent.OnServerEvent:Connect(server_Event)

There doesn’t seem to be any errors in the code, as per me, are you sure you are checking the Server Side Output? Someone else faced a similar problem before few weeks, and this was the reason.

I did check the server output (through developer console), not even a single output that is related to it.

Could you check if the Server script itself is running at the first place till the OnServerEvent? Probably place a print statement before that Connection.

I will be doing that at the moment. Hang on…

I did what you told me to do and it printed perfectly. But it seems like the remote isn’t being fired since the handler of this remote seems to be fine without errors.

just a side note too, semicolons aren’t needed at the end of lines ever unless you’re working with a table or something

3 Likes

This seems kind of weird to me, your best option is to check if the Remote event is even being fired or not, if not, something is probably wrong in your client code.

Also are there any errors in client/server side output?

he’s firing the server from the client so no

This isn’t going to work. You should use a variable instead because what you’re doing is making it a lot more complicated. Do the following:

local player = game.Players.LocalPlayer

replace all player.PlayerGui with player.

I agree he is referencing it like that, but why would it not work? It is still the same thing.

Also if he replaces player Gui references with the player instance, how will it work though.

1 Like

He doesn’t need to do it in the local script since local scripts are already a part of the player. The variable example should only be a part of the local script.

1 Like

Taking into consideration, it works and it does appear for the player who accepts it, but not for the player who sent the request considering the remote event isn’t being fired.

Which part isn’t working? The Server side or client side?

The remote event handler does not execute when I fire the remote event through the local script. Which could be understandable most likely by the reason, that the remote event isn’t being fired.

Does it print this print statement or is it not reached at all? Do you think Semicolons are doing something to it?

If that is the case, then you should try placing a print statement just above the FireServer call, and see if its printing.

1 Like

It does not print it. I’ve been putting semicolons are variables etc for a very long time, and a similar issue has never happened not once even.

Just done that, put a print after the FireServer call, and it printed succesfully. I have no idea what problem could possibly cause that.

This is confusing now, I even tried testing in my studio and nothing is wrong with RemoteEvents. But you said the other player’s GUI is changing? So that means the remote event is working right, the thing is probably you aren’t on the right console tab.