What can be sent through Remote Events?

So, recently I have been working on a game and I was storing information on the client side via an array and was wondering how to send it to the server. The array stores multiple data types with multiple types of indices. If sending the array is not probable or possible, above all else I want to execute a function on the server that was created on the client. I know the basics of Remote Events, but the function is nil on the server side script and various array elements have been deleted. Any help is appreciated. Thanks!

1 Like

having the server run functions sent from the client is unsecure, and was also the reason why loadstringenabled is a toggleable option under server script service.

you should try to find a way to turn certain data types which cant be sent in your array into a string format, and then have the server convert that string back into its original data.

Example:
Client sends the CFrame CFrame.new(1,1,1) as the string "CF.N 1, 1, 1"

then the server sees that the first 4 letters are ‘CF.N’ and identifies it as a new CFrame and takes the rest of the string as the arguments to the new cframe, turning it back into CFrame.new(1,1,1)

1 Like

A remote only sends serializable data like arrays of strings, numbers, booleans, etc.

What is in your array?

I recommend reading this docs. You cannot send a function via Remote Event/Function.

If im not wrong, you can send everything by a remote event. The problem starts when you try to sent an instance wich don’t exists in the other side: For example:
On client:

local Part = Instance.new("Part")
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents"):WaitForChild("RemoteEvent"):FireServer(Part, "Hello")

On Server:

RemoteEvent.OnServerEvent:Connect(function(player, Sent1, Sent2)
   print(Sent1) --> It will print "nil" since the object don't exist on the server.
   print(Sent2) -->It will print "Hello" since the object is a string.
end)
1 Like

Thank you! This documentation answered my question.

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