It says that Character is a nil value. This script works in solo but not in server :(
player = game.Players.LocalPlayer mouse = player:GetMouse() bar = script.Parent holding = false player.Character.Humanoid.Changed:connect(function() bar.Size = UDim2.new(player.Character.Humanoid.Health / player.Character.Humanoid.MaxHealth, 0, 1, 0) end)
Please help!
The thing is, the Character loads a little bit after the Player does. So, if we add repeat wait() until player.Character
then the script will function as a Character is detected.
repeat wait() until game.Players.LocalPlayer.Character player = game.Players.LocalPlayer mouse = player:GetMouse() bar = script.Parent holding = false player.Character.Humanoid.Changed:connect(function() bar.Size = UDim2.new(player.Character.Humanoid.Health / player.Character.Humanoid.MaxHealth, 0, 1, 0) end)