-
What do you want to achieve? Change a NumberValue’s Value everytime a Character’s Humanoid’s health is changed
-
What is the issue? Whenever i give the function the Humanoid Instance, it goes through as the Humanoids Health
-
What solutions have you tried so far? I can’t make sense out of what is going wrong lol
Code:
local ChangeMulti = function(Humanoid,Value)
print(Humanoid)
local Health = Humanoid.Health
local MaxHealth = Humanoid.MaxHealth
Value.Value = Health/MaxHealth
end
-- I know this is a unreliable way to get the Character, but i made it simple to focus on the part of the code that isn't working
local Character = game.Workspace:WaitForChild("Tiagogibbon2")
local Humanoid = Character:WaitForChild("Humanoid")
Multiplier = Instance.new("NumberValue")
ChangeMulti(Humanoid,Multiplier)
Multiplier.Parent = game.Workspace
Humanoid.HealthChanged:Connect(ChangeMulti,Humanoid,Multiplier)
wait(1)
Humanoid:TakeDamage(25)
Error message: 3: attempt to index number with ‘Health’
(I get it when the humanoid health changes)
Script is on ServerScriptService btw