Please note that my game is Filtered Enabled and there is a remote event I'm using to apply changes.
P.S. There are no errors in output either.
01 | --//LOCALSCRIPT |
02 |
03 | --//Variables |
04 | local plr = game.Players.LocalPlayer |
05 | local chr = plr.Character |
06 | local hum = chr.Humanoid |
07 | local bar = script.Parent.Parent |
08 | local hbar = script.Parent |
09 | local htxt = script.Parent.TextLabel |
10 | repeat wait() until plr.chr |
11 | local healthMath = hum.Health / (hum.MaxHealth) |
12 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
13 | local healthEvent = replicatedStorage.healthEvent |
14 |
15 | --//Booleans |
01 | --//SCRIPT |
02 |
03 | --// Variables |
04 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
05 | local healthEvent = replicatedStorage.healthEvent |
06 |
07 | --// Scripting |
08 |
09 | local function onHealthChanged(player) |
10 | local hum = player.Character:WaitForChild( "Humanoid" ) |
11 | local healthMath = hum.Health / (hum.MaxHealth) |
12 | local hBar = player.PlayerGui.healthAssets.healthBar |
13 | hBar:TweenSize(UDim.new(healthMath, 0 , 1 , 0 ), "Out" , "Sine" , . 2 ) |
14 | end |
There are no errors in output either.
Woah woah WOAH. Pretty sure you messed the order up. Why on earth does the server handle it? You can do all that in a local script with a few lines Simply change the size based on the players health. Player1 doesnt need to know what size Player 2's health gui is. Only the health. Not exploiter proof, people could exploit the gui, but that doesnt affect gameplay. This example is intended to work in a local script, inside Frame,2 which is inside Frame1. Frame 1 would be the background of the loading bar, Frame 1 being the loading bar.
1 | while wait( 1 ) do |
2 | script.Parent.Size = Udim 2. new( 1 , 0 , game.Players.LocalPlayer.Character.Humanoid.Health/MaxHealth, 0 ) |
3 | end |