Issue with defining a variable across remote events

hey, if your here from seeing my previous post, yea thats been mostly solved
there is one problem though that remains and i know is just the single one thing that is breaking the whole process

i want to carry the C1 of RightShoulder from the player to another players local script (using remote events firing to a receiver then firing to clients then onclientevent) then replace the server side C1 of the player with the C1 that was fired from the same player, resulting in the arm location and orientation being the same on the server as it is on the client where the player is moving it on
hope this is even understandable…

my current attempt at trying to get the local C1 to be the server C1 too:

game.ReplicatedStorage.Look.OnClientEvent:Connect(function(value, player, ArmRotation)
	value.Character.RightUpperArm:WaitForChild("RightShoulder").C1 = ArmRotation
end)

game:GetService("RunService").RenderStepped:Connect(function()
	ArmRotation = char.RightUpperArm.RightShoulder.C1
	game.ReplicatedStorage.Look:FireServer(ArmRotation)
end)

A RemoteEvent can only send Player and one other variable across. The Player who fired the remote is automatically sent, so you only have one variable with which to play.
You could put them both value and ArmRotation in a table, then separate it out at the server side.

1 Like

a remote event can send multiple values at once not just one value

I could do

RemoteEvent:FireServer(A, B, C)

RemoteEvent.OnServerEvent:Connect(function(Player, A, B, C)
    -- code
end)

or I could do

RemoteEvent:FireClient(Player, A, B, C)

RemoteEvent.OnClientEvent:Connect(function(A, B, C)
    -- code
end)
2 Likes

Oh. When I was trying to update my Shop remote event the other day, it would only ever send one var when I was testing when I was trying to differentiate between different item type purchases…

well you must have done something wrong then

I have a lot of experience with remote events including how to prevent exploiters from abusing them

You’re probably right about doing something wrong. I am still stumbling around in the dark sometimes

ill put it as solved as it worked but the main goal that im still trying to achieve isnt, so yea ill just commission it since i have almost 10k to spare for advertising after selling a limited and im absolutely done with this piece of crap bugging my mind for 4-5 months or so by now