I'm not sure. I just found out about Remove Event Today, And I Think You can transfer data over Server To Client With it, but I'm having problems. Can you tell be the structure of Sending Data From Local Scripts To Server Scripts and Vice Versa?
Well, let's see.
RemoteEvents are in fact a way to securely transport data from the server to the client, or vice versa.
So, let's look at an example. Say you have an event, we'll call it "PlayerStatsUpdated". Now, before you created this event, your game was struck by exploiters who used Cheat Engine to change the stats of players. Before you created this event, there was nothing to prevent people from going into your game and giving themselves 99999999999999999999 kills and infinity coins or whatever. Soon, the people who played your game started complaining, and then nobody played anymore.
So, when you find out about that, you think "Oh no! Now I have to prevent this from happening? HOW?!?!" Well, RemoteEvents are the answer.
But how do they work?!
Well, let's say that you have the PlayerStatsUpdated event. What you can do to prevent the above scenario is firing the event from the client, and passing in the parameters (kills, coins, etc). Then, you can listen for it from a server script, which then handles updating the statistics.
Now, this isn't entirely foolproof. Someone COULD find the name of the event and exploit the game again (Well, only if they knew how the event system worked and what parameters to use), unless you have FilteringEnabled!
So. How do we fire the events?
FROM A LOCAL SCRIPT:
repeat wait() until _G.PlayerStats ~= nil local PlayerStatsUpdated = game.ReplicatedStorage.PlayerStatsUpdated local player = game.Players.LocalPlayer _G.PlayerStats[player.Name] = { kills = 0, coins = 0 }; PlayerStatsUpdated:FireServer({kills = 10, coins = 5})
That last line ("PlayerStatsUpdated:FireServer({kills = 10, coins = 5})") is what sends the event to the server.
Now, from a server script:
_G.PlayerStats = {}; local PlayerStatsUpdated = game.ReplicatedStorage.PlayerStatsUpdated PlayerStatsUpdated.OnServerEvent:connect(function(player, stats) _G.PlayerStats[player.Name] = stats print("stats updated for " .. player.Name) print("kills = " .. _G.PlayerStats[player.Name]["kills"]) print("coins = " .. _G.PlayerStats[player.Name]["coins"]) end)
I hope this helped! :)