I originally had this code to update a health slider when a player interacted with a button which worked just fine:
UpdateHealthSlider(Message: widget_message):void = Playspace: fort_playspace = GetPlayspace() # Create a playspace AllPlayers: []player = Playspace.GetPlayers() # Get all players and put in an array if(FirstPlayer: player = AllPlayers[0]): if(PlayerRefOne: fort_character = FirstPlayer.GetFortCharacter[]): TrueHealth := MyUIHealthSlider.GetValue() PlayerRefOne.SetMaxHealth(TrueHealth) PlayerRefOne.SetHealth(TrueHealth) return
However, I’d like all players in the game to be affected by the slider and I can’t figure out how to do it. I tried this:
UpdateHealthSlider(Message: widget_message):void = Playspace: fort_playspace = GetPlayspace() # Create a playspace AllPlayers: []player = Playspace.GetPlayers() # Get all players and put in an array if((FirstPlayer: player = AllPlayers[0]) or (SecondPlayer: player = AllPlayers[1])): if((PlayerRefOne: fort_character = FirstPlayer.GetFortCharacter[]) and (PlayerRefTwo: fort_character = SecondPlayer.GetFortCharacter[])): TrueHealth := MyUIHealthSlider.GetValue() PlayerRefOne.SetMaxHealth(TrueHealth) PlayerRefOne.SetHealth(TrueHealth) PlayerRefTwo.SetMaxHealth(TrueHealth) PlayerRefTwo.SetHealth(TrueHealth) return
The code won’t run without errors which is already an issue but, even if it did work, I’d have to add on lots of ineffiencient code to expand this to fit 6 players instead of 2.
Is there any other way to change the player health/shields of the whole lobby?