Answered by
4 years ago Edited 4 years ago
When a remote event is fired by the client, the OnServerEvent function will automatically have the parameter of said client that fired it.
Example
1 | event.OnServerEvent:Connect( function (player) |
You don't need to pass the player through, and the only thing you need to pass through is your "amount" variable.
Local Script
1 | script.Parent.Activated:Connect( function () |
2 | local amount = game.ReplicatedStorage.Apple:FindFirstChild( "1" ).Amount |
3 | game.Workspace.RemoteHandler.Eat:FireServer(amount) |
Server Script
1 | event.OnServerEvent:Connect( function (player, amount) |