Running into an issue with sending parameters over a RemoteEvent

  1. What do you want to achieve? Keep it simple and clear!

I want to send a string and a number, in that order.

  1. What is the issue? Include screenshots / videos if possible!

The event is firing from a local script, to a server-side module script. But everytime I fire it the first parameter (not player) always equals 1, and the second always equals nil. player still reaches it just fine, but any parameters after follow the pattern I mentioned.

Local Script

ItemDataEvent:FireServer("abc", 123);

Server-Side Module Script

local ItemDataEvent = script.ItemDataEvent.Value;

local Class = {};
Class.__index = Class;

function Class.new(player)
	local self = setmetatable({}, Class);

	self.ItemDataEvent = ItemDataEvent.OnServerEvent:Connect(function(player, string, number) 
		print(player); 
        print(string); 
        print(number);
	end)

    return self;
end

Output

0: DylanD319
1: 1
2: nil

I haven’t had any luck on finding cases similar, so here I am.
Maybe Module Scripts can’t connect RemoteEvent Parameters like Server Scripts? I don’t know. Any help would be greatly appreciated!

Edit: Just adding quick context for the module script if needed.

Could it be because the parameters you’re sending to the server script don’t match the ones the server script is calling on?

Sorry if this isnt what you’re asking, i am not 100% what you exactly want but i hope this helps!

I’ll change the naming a bit rq to get a better idea.

This is really weird behaviour i have never seen this before.
Could you make a rbxl (place file) that replicates this issue? It possibly could be an engine issue but probably not?.
I am not asking for the game by the way just make a blank place and try to replicate the issue and if you are not comfortable with doing so, you don’t need to.

Will try to make one really quick

Not sure, but shouldn’t the “string” parameter be conflicting with the built-in string library?
I’m guessing the Module is in ReplicatedStorage, right?

Was able to fix it. This did work correctly, but as I was working through recreating it I noticed that the references were using the wrong event. I named them in such a way that they are near identical at a quick glance so I must’ve missed it when I checked before posting.

It did seem like some really strange behavior cuz I swear I’ve done this in previous projects before, but ye it was just user error.

Thanks for the help @selmanankarozt1342 @Foxstream52

1 Like

I was just using that as an example to make it easier to read, it originally was named “actionType”.

1 Like

I will still upload the working example rbxl incase someone wanted it.

ClassClient-To-ServerEvent.rbxl (61.1 KB)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.