Script changing a part's color based on player health not working

I have a part (the white part below) that should change colors when the players health changes, but it does not seem to work.
image

local part = script.Parent
local player = game.Players.LocalPlayer

local function changeColor()
if player.Character.Humanoid.Health >= 75 then
part.Color = Color3.fromRGB(0, 255, 0)
elseif player.Character.Humanoid.Health >= 50 then
part.Color = Color3.fromRGB(255, 255, 0)
elseif player.Character.Humanoid.Health >= 25 then
part.Color = Color3.fromRGB(255, 165, 0)
else
part.Color = Color3.fromRGB(255, 0, 0)
end
end

changeColor()

player.Character.Humanoid.HealthChanged:Connect(changeColor)
The script is located here
image

This line will not work in server scripts. I would advise this script:

local part = script.Parent

game.Players.PlayerAdded:Connect(function(plr)
    local function changeColor()
        if plr.Character:WaitForChild("Humanoid").Health >= 75 then
            part.Color = Color3.fromRGB(0,255,0)
        elseif plr.Character:WaitForChild("Humanoid").Health >= 50 then
            --you know the rest, just continue your original script from here but make sure to use the variable "plr"
            

Why won’t that work in server scripts?

Because the server can’t return the local player that is playing live time on one player’s account

ok. But won’t we add like speed limits there for a live player? For example if a player > 12 walkspeed there health will = 0

This isn’t @DancingCow505’s topic so we shouldn’t discuss this right now, DM me if you want to talk more