Help with RemoteEvent arguments

I need help with arguments when firing Remote Event. I want to send 2 arguments

  1. status
  2. class

The problem is when info gets to server side script it replaces class argument with player name. I don’t need player name in arguments so please help.

There is 2 inputs for arguments. None of these args aren’t without input

Could you provide code for both client and server?

image

Here is the output.

Green is server side (arguments that come to remote)
Blue is output from local script (arguments that need to go)

1 Like

Make sure you set up the remotes correctly.
To set up a remote sever-side:

RemoteEvent.OnServerEvent:Connect(function(player, status, class)
	-- ...
end)

and to fire the event

RemoteEvent:FireServer(status, class)
7 Likes
-- Anti-Jump system v 1.0.0-Alpha

local RemoteEvent = game.ReplicatedStorage.UpdateJump -- Change Path to your one

local player = game.Players.LocalPlayer

for i,v in pairs(script.Parent:GetChildren()) do
	if v:IsA("ImageLabel") and v.Name ~= "LeMondeLogo" then
		local status = v.Status.Text or tostring(v.Status.Text)
		local class = v.Class.Text or tostring(v.Class.Text)
		v.Trigger.MouseButton1Click:connect(function()
			if status == "Off" then
				script.Status[class].Value = "On"
				status = "On"
				v.Status.Text = "On"
			else
				script.Status[class].Value = "Off"
				status = "Off"
				v.Status.Text = "Off"
			end
			RemoteEvent:FireServer(script.Status[class].Value, script.Status[class].Name)
			print(status .. " ," .. class)
		end)
	end
end

Local script ^^

-- LeMonde Airlines
-- INSERT CREDITS HERE

local GroupID = 1156950 -- Group ID
local minRank = 140 -- Minimal Rank to be able to jump

local RemoteEvent = game.ReplicatedStorage.UpdateJump -- Replace Path with your one

function Update(status, class)
	for i,v in pairs(game.Players:GetChildren()) do
	local plr = game.Players[v.Name]
	local char = plr.Character or game.Workspace:WaitForChild(plr.Name)
	char.Humanoid.JumpPower = 0
	
	print(status)
	print(plr.Name)
	print(class)
	
	if status == "On" then
		if class == "EC" then
			if game.ReplicatedStorage.LmdPhone.PlayersCheckedIn[plr.Name].Value == "EC" then
				char.Humanoid.JumpPower = 50
			end
		elseif class == "PE" then
			if game.ReplicatedStorage.LmdPhone.PlayersCheckedIn[plr.Name].Value == "PE" then
				char.Humanoid.JumpPower = 50
			end
		elseif class == "BC" then
			if game.ReplicatedStorage.LmdPhone.PlayersCheckedIn[plr.Name].Value == "BC" then
				char.Humanoid.JumpPower = 50
			end
		elseif class == "FC" then
			if game.ReplicatedStorage.LmdPhone.PlayersCheckedIn[plr.Name].Value == "FC" then
				char.Humanoid.JumpPower = 50
			end
		elseif class == "Staff" then
			if plr:GetRankInGroup(GroupID) >= minRank then
				char.Humanoid.JumpPower = 50
			end
		elseif class == "All" then
			char.Humanoid.JumpPower = 50
		end
	elseif status == "Off" then
		if class == "EC" then
			if game.ReplicatedStorage.LmdPhone.PlayersCheckedIn[plr.Name].Value == "EC" then
				char.Humanoid.JumpPower = 0
			end
		elseif class == "PE" then
			if game.ReplicatedStorage.LmdPhone.PlayersCheckedIn[plr.Name].Value == "PE" then
				char.Humanoid.JumpPower = 0
			end
		elseif class == "BC" then
			if game.ReplicatedStorage.LmdPhone.PlayersCheckedIn[plr.Name].Value == "BC" then
				char.Humanoid.JumpPower = 0
			end
		elseif class == "FC" then
			if game.ReplicatedStorage.LmdPhone.PlayersCheckedIn[plr.Name].Value == "FC" then
				char.Humanoid.JumpPower = 0
			end
		elseif class == "Staff" then
			if plr:GetRankInGroup(GroupID) >= minRank then
				char.Humanoid.JumpPower = 0
			end
		elseif class == "All" then
			char.Humanoid.JumpPower = 0
		end
		end
	end
	end

RemoteEvent.OnServerEvent:Connect(Update)

Server side ^^

2 Likes

when server recieves remotes it’s always required to have player as argument1 no matter what, and most of the time you will need it (assuming status and class are for a specific player) even if you don’t adding an extra argument as arg1 on the receiving function without using it won’t do anything bad, if not come handy later.
function(player, arg1, arg2, …)
theres no way to avoid this, it’s just how all remotes work.

1 Like