script.Parent.Activated:Connect(function() local playername = script.Parent.Parent.Name local player = game.Players:FindFirstChild(playername) local amount = game.ReplicatedStorage.Apple:FindFirstChild("1").Amount game.Workspace.RemoteHandler.Eat:FireServer(player,amount) end)
When a remote event is fired by the client, the OnServerEvent function will automatically have the parameter of said client that fired it.
Example
event.OnServerEvent:Connect(function(player) print(player.Name) end)
You don't need to pass the player through, and the only thing you need to pass through is your "amount" variable.
Local Script
script.Parent.Activated:Connect(function() local amount = game.ReplicatedStorage.Apple:FindFirstChild("1").Amount game.Workspace.RemoteHandler.Eat:FireServer(amount) end)
Server Script
event.OnServerEvent:Connect(function(player, amount) -- put code here end)