--!optimize 2 --!native --!strict type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor)) type Impl_Constructor = { __index: Impl_Constructor, constructor: Constructor_Fun, --Class functions Enable: (self: ClassConstructor) -> (), Disable: (self: ClassConstructor) -> (), DisplayHealth: (self: ClassConstructor, Amount: number) -> (), } & Impl_Static_Props type Impl_Static_Props = { Enabled: boolean } type Constructor_Fun = (PlayerGui: PlayerGui) -> ClassConstructor type Constructor_Return_Props = { HealthGui: ScreenGui, Amount: TextLabel } local HealthModule = {} :: Impl_Constructor HealthModule.__index = HealthModule HealthModule.Enabled = false function HealthModule.constructor(PlayerGui: PlayerGui) local HealthGui = PlayerGui:WaitForChild("Health") :: ScreenGui local Amount = HealthGui:WaitForChild("Amount") :: TextLabel return setmetatable({ HealthGui = HealthGui, Amount = Amount }, HealthGui) end function HealthModule:Enable() HealthModule.Enabled = true end function HealthModule:Disable() HealthModule.Enabled = false end function HealthModule:DisplayHealth(Amount: number) self.Amount.Text = tostring(Amount) if Amount <= 40 then self.Amount.TextColor3 = Color3.fromRGB(255,238,0) elseif Amount <= 20 then self.Amount.TextColor3 = Color3.fromRGB(255,0,38) else self.Amount.TextColor3 = Color3.new(1,1,1) end end return HealthModule