"Transfer" a lot of number values trough just 1 remote event

This is my script and what it does it moves the rudder and elevator I have on my plane. now the problem is this is in a local script and I want it to work for everyone not just the local player. The Rudder and Elevator value update every second and they are big numbers(depending on where the mouse is on the screen). Instead of having a million remote events can I transfer the current Rudder value(updates every second or less) trough one remotevent and then a normal script reads the value and sets it on the motor 6D. Is this even possible? If not any other way to do this?


while true do wait()
	local player = game.Players.LocalPlayer
	local mouse = player:GetMouse()
	local Elevatorcenter = 273
	local Elevator = (mouse.Y - Elevatorcenter) / 1236
	local Ruddercenter = 454
	local Rudder = (mouse.X - Ruddercenter) / 1816
	game.Workspace.a2.Motor.DesiredAngle = Rudder
	game.Workspace.a.Motor.DesiredAngle = Elevator
end

Remote events can have multiple arguments.

You can send multiple args through, just like @blokav said. Example:

Client:

local arg1 = 1
local arg2 = 2
local arg3 = 3
local arg4 = 4

game.ReplicatedStorage.Event:FireServer(arg1, arg2, arg3, arg4)

Server:

game.ReplicatedStorage.Event.OnServerEvent:Connect(function(plr, arg1, arg2, arg3, arg4)
    print(arg1, arg2, arg3, arg4)
end)

This was written in this post, so it’s a bit crude.

Cheers!

EDIT: It will print 1, 2, 3, 4 in the output.

1 Like

Just as a small correction here, remote events fired from the client automagically send the player as the first argument. This should be taken into consideration on the server script.

game.ReplicatedStorage.Event.OnServerEvent:Connect(function(plr, arg1, arg2, arg3, arg4)
    print(arg1, arg2, arg3, arg4)
end)

Otherwise, you can send as many arguments as you like through a remote event.

2 Likes

Oh yes! Of course, sorry. Let me edit that. Again, I made it in here and totally blanked for a second. Thank you!

Thank you very much,works perfectly! :heart:

1 Like