So I have a script listening to a RemoteEvent to see when to give x client infinite health. Problem is, when it does get called it doesn't work at all. I don't understand why it doesn't because setting the players health to something like 300 works. The game does have FilteringEnabled, and no output is printed.
function GetHumanoidFromPlayer(Plr) if (Plr ~= nil) then if (Plr.Character ~= nil) then local Find = Plr.Character:FindFirstChild("Humanoid") if (Find) then return Find end end end return nil end InfHealth.OnServerEvent:connect(function(Plr) if (CheckAdmin(Plr)) then local Hum = GetHumanoidFromPlayer(Plr) if (Hum ~= nil) then Hum.MaxHealth = math.huge end end end)
Seems like this should be an easy fix.
function GetHumanoidFromPlayer(Plr) if (Plr ~= nil) then if (Plr.Character ~= nil) then local Find = Plr.Character:FindFirstChild("Humanoid") if (Find) then return Find end end end return nil end game.Players.PlayerAdded:connect(function(Plr) plr.CharacterAdded:connect(function(char) -- I am hoping this is the right term for it.. if (CheckAdmin(Plr)) then local Hum = GetHumanoidFromPlayer(Plr) if (Hum ~= nil) then Hum.MaxHealth = math.huge Hum.Health = math.huge end) end)
Hope this works for you!