Alright so. I'm unable to figure out how to make this
1 | game.Workspace.Localplayer.Humanoid.Health = 10 |
but with a serversided script and changing the Localplayer variable to something that works serversided.
For example
1 | if game.Players.Localplayer.leaderstats.Power.Value = = 35 then |
2 | game.Workspace.Localplayer.Humanoid.Health = 10 |
3 | -- Just for testing print(Localplayer.Name + " has 35 in power" + game.Workspace.playername.Humanoid.Health == 10) |
4 | end |
If you wanted to do it for all players, you can use PlayerAdded in a server script:
1 | game.Players.PlayerAdded:Connect( function (plr) |
2 | plr:WaitForChild( "leaderstats" ):WaitForChild( "Power" ).Changed:Connect( function (newVal) |
3 | if newVal = = 35 and plr.Character then |
4 | plr.Character:WaitForChild( "Humanoid" ).Health = 10 |
5 | end |
6 | end ) |
7 | end ) |