Hello! :) I made a system that when a player press a button on a ScreenGui, the value in leaderstats will change. It works perfectly, the values changes both in the client and in the server. But now I got a problem: I want to change the Local Player's Health to the new value in the leaderstats, so for this I've tried to add this on this simplified version of the Server Script, just for testing if it will work correctly:
game.ReplicatedStorage.RemoteFunction.OnServerInvoke = function(player)
print(game.Workspace.player.Humanoid.MaxHealth.Value)
end
So when I run it and invoke the server, this appears on the output: player is not a valid member of Workspace
I've also tried change to
game.ReplicatedStorage.RemoteFunction.OnServerInvoke = function(player)
print(game.Workspace[player].Humanoid.MaxHealth.Value)
end
And
game.ReplicatedStorage.RemoteFunction.OnServerInvoke = function(player)
print(game.Workspace:FindFirstChild(player).Humanoid.MaxHealth.Value)
end
But they didn't worked too.

4 comments
player.Character? Also, I either don't know roblox's humanoids or the ".Value" part of the print should be removed. unless it is a IntValue of some sort (which still should be named something like MaxHealth2)
'player' is a Player Instance. You can only index things in the Explorer by name, not object. Instead, use the player's Name. game.Workspace[player.Name].Humanoid.MaxHealth - remember that player's don't need a character to invoke things which would produce an error in your code. MaxHealth is a number so it has no attributes like 'Value'.
Thank you!
I've changed the 2 line to this: print(player.Character.Humanoid.MaxHealth)