local Humanoid = script.Parent:WaitForChild("Humanoid")
local currentHealth = Humanoid.Health
local RewardGold = script.Parent.Rewards.Gold.Value
local RewardExp = script.Parent.Rewards.Exp.Value
local Player = game.Players.LocalPlayer
local Gold = game.ReplicatedStorage:WaitForChild(Player.Name.." Values").Gold
local Exp = game.ReplicatedStorage:WaitForChild(Player.Name.." Values").Exp
--Variables
Humanoid.Died:connect(function() --This function Doesn't Run
print("This Will Display if Function Runs")
--Changes an IntValue in ReplicatedStorage
Gold.Value = Gold.Value + 5
Exp.Value = Exp.Value + 1
end)
Humanoid.HealthChanged:connect(function(Health) --This Runs
local Change = math.floor(currentHealth - Health)
local Gui = script.Parent.Head:FindFirstChild("Damage")
if Change > 0 then
if Gui == nil then
Gui = Instance.new("BillboardGui", script.Parent.Head)
Gui.Name = "Damage"
Gui.Size = UDim2.new(0,100,0,10)
Gui.StudsOffset = Vector3.new(0,3,0)
Gui.MaxDistance = 20
--This Will Display Damage Player has done
local DamageIndicator = Instance.new("TextLabel", Gui)
DamageIndicator.TextColor3 = Color3.new(255,255,255)
DamageIndicator.Text = Change
DamageIndicator.BackgroundTransparency = 1
DamageIndicator.Size = UDim2.new(1,0,1,0)
currentHealth = math.floor(math.abs(currentHealth - Change))
wait(1)
end
end
if Gui ~= nil then
Gui:Remove()
end
end)
This is a localscript inside of an npc
i created a print to test if the first function runs at all and nothing is displayed in output. No errors are shown either. I also have filtering enabled if that is doing something.
what am i doing wrong?

1 comment
I don't know what's wrong. I just know that you should use :Connect() and not :connect() since it is depreciated.