Is this normal?: RemoteEvent parameters has different order when i fire them

If i put a remoteevent. i do everything as it needs to be: i put the selected parameters, but when i fire them, example for string, number parameters, the order is different: number, string and in the line to fire it i need to put number, string instead of string, number, it didn’t happened before like september 2023, but after that month the parameters are in different order when firing remote events, Is this normal??

2 Likes

Could you provide both the server-side and client-side scripts?

1 Like

I was developing a game, the problem was in another game, wait i’m gonna go to that game. brb

as this problem didn’t fixed, i had to change order of parameters, i don’t know if this makes problems:

client Script: FlagCreator, in my next game Create Your Own Country (not providing full script)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local ScreenGUI = Players.LocalPlayer.PlayerGui:WaitForChild('ScreenGui')
local Packages = ReplicatedStorage:WaitForChild('Packages')
local Color = require(Packages:WaitForChild('Color'))
local flagChoiceEvent = ReplicatedStorage:WaitForChild('Events'):WaitForChild("FlagChoiceEvent")
local player = Players.LocalPlayer
local Unused = "Square, Circle, Star, Triangle"

ScreenGUI.CreateCountryThingy.Create.MouseButton1Click:Connect(function()
	
	ScreenGUI.FlagCreator.Visible = false
	ScreenGUI.CreateCountryThingy.Visible = false
	local CName = ScreenGUI.CreateCountryThingy.CountryName.Text
	ReplicatedStorage:WaitForChild('Events'):WaitForChild('CreateCountry'):FireServer(player.Name, CName)
end)

ServerScript: MainGlobal

--[[
     MADE BY BAS
   DO NOT LEAK THIS
         🙂

]]

-- SERVICES --
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Teams = game:GetService('Teams')
local DataStoreService = game:GetService('DataStoreService')
-- Reference to the player's data
local playerData = {}
local reservedCountryNames = {
	"YouTubeLand",
	"FamousCountry",
}

-- Folder to store country data
local countryDataFolder = ReplicatedStorage:WaitForChild("GlobalCountryData")
local Templates = ReplicatedStorage:WaitForChild('Templates')

-- Global table to store information about all countries
local GlobalCountryData = {}

-- Table to store player-created countries
local playerCountries = {}
local BannedPlayersDataStore = DataStoreService:GetDataStore("BannedPlayers")

-- Table to store currently banned players
local bannedPlayers = {}

-- Function to check if a player is banned
local function isPlayerBanned(player)
	return bannedPlayers[player.UserId] == true
end
end)
-- Function to create a new country
local function createCountry(player, countryName)
	local yay, plsno = pcall(function()
		local Plr = player

		-- Check if the player has already created a country
		if playerCountries[Plr] then
			return "You can only create one country!"
		end

		local newCountry = Templates:WaitForChild('CountryData')
		if not newCountry then
			return "Country template not found!"
		end

		-- Check if the country name is reserved
		if table.find(reservedCountryNames, countryName) then
			return "This country name is reserved for special users."
		end

		newCountry = newCountry:Clone()
		newCountry.Name = countryName
		newCountry.Parent = countryDataFolder

		-- Add country data
		newCountry:WaitForChild('Population').Value = 1
		newCountry:WaitForChild('OwnerUsername').Value = Plr.Name
		newCountry:WaitForChild('Name').Value = countryName

		-- Update global country data
		GlobalCountryData[newCountry.Name] = {
			Population = 1,
			Name = countryName,
			Creator = player.Name or player,
			MilitaryAmount = 1,
		}

		-- Store player's created country
		playerCountries[Plr] = newCountry

		local countryTeam = ReplicatedStorage:WaitForChild('Templates'):WaitForChild('CountryTeam'):Clone()
		countryTeam.Name = countryName
		countryTeam.AutoAssignable = false
		countryTeam.TeamColor = BrickColor.random()
		countryTeam:SetAttribute("Leader", newCountry:WaitForChild('OwnerUsername').Value)
		countryTeam.Parent = Teams
		Plr.Team = countryTeam

		-- Additional setup for sub-teams (states/provinces) if needed
		while wait(1, 9) do
			newCountry.Population.Value += math.random(1, 5)
		end

		print('Country Created!')
		return "Country created successfully!"
	end)

	if yay then
		print('Success!')
	elseif not yay then
		-- Handle error
		warn(plsno and tostring(plsno) or "Unknown error")
	end
end
-- SCRIPT WHERE THE PROBLEM STARTS
ReplicatedStorage:WaitForChild('Events'):WaitForChild('CreateCountry').OnServerEvent:Connect(function(Player, CountryName)
	createCountry(Player, CountryName)
end)

context: in the client script, i need to change the order of the fire parameters if there are more than 2, or else there should be an error or the stuff creates with the wrong name.

2 Likes

The player instance who of fired the RemoteEvent is automatically passed by Roblox and will always be the first parameter for RemoteEvent.OnServerEvent.

Here’s how you should do it:
RemoteEvent:FireServer(CName)

3 Likes

also the CName is used as Country name, so i need to provide a player at first parameter?

1 Like

You can name the parameter anything you want. Just know it’s always the first parameter so you need to include it in your RemoteEvent.OnServerEvent.

1 Like

i now understand, i Already know that every parameter it’s the same even if we change its name (sry for my bad English btw.)

We need to provide a client at first parameter?, i didn’t understand at all

1 Like

i mean, the client who fired it

We need to provide a client at first parameter?, i didn’t understand at all

Yes, because Roblox automatically passes the player instance of who fired the RemoteEvent to the server with Remote.OnServerEvent.
This is default behavior and can’t be changed.

2 Likes

ok, my problem is fixed, Thank you!

1 Like

You’re welcome! :slightly_smiling_face:
Feel free to reach out if further help is needed.

1 Like

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