Hello guys,
I have a model, which also has a part, a script and a intValue called health with value defaulted to 100 as direct child.
The script code is:
local entity = script.Parent
local entityHealth = entity:FindFirstChild("health")
entityHealth.Changed:Connect(function(newVal)
print ('hit')
end)
Then, when my player sword hits this object, I'm decreasing the value of this intValue with the following code:
local axe = script.Parent
local blade = axe.Blade
function onBladeTouch (part)
local entity = part.Parent
local health = entity:FindFirstChild("health")
health.Value = health.Value - 5
print (health.Value)
end
blade.Touched:Connect(onBladeTouch)
On my sword script I get the console output of the intValue (health) been constantly decreased, but the entityHealth.Changed event from inside my model (code at the top) never gets fired, so I'm wondering whats wrong.
Thanks in advance.

1 comment
edited my code