I think the problem here is, you are looking for a child named “NumberValue” but not a NumberValue itself.
Use FindFirstChildWhichIsA() to find a type of child instead of the name of a child
11 | trail = script.Parent.Head.Trail, |
15 | local Tool = script.Parent |
16 | local Handle = Tool:WaitForChild( "Handle" ) |
18 | local anim = Tool:WaitForChild( "Animation" ) |
19 | local Players = game:GetService( "Players" ) |
22 | if Properties.sound_fx then |
23 | sound = Handle:WaitForChild( "Sound" ) |
24 | sound.SoundId = BaseUrl .. Properties.soundID |
25 | sound.MaxDistance = 100 |
26 | sound.RollOffMode = Enum.RollOffMode.InverseTapered |
31 | if Properties.anim_check then |
32 | anim.AnimationId = BaseUrl .. Properties.AnimID |
36 | if Properties.ToolDrop = = true then |
37 | Tool.CanBeDropped = true |
40 | Tool.Equipped:Connect( function (Mouse) |
41 | local player = Players:GetPlayerFromCharacter(Tool.Parent) |
42 | if Properties.anim_check = = true then animation = player.Character.Humanoid:LoadAnimation(anim) end |
44 | Tool.Activated:Connect( function () |
45 | if Properties.debounce then |
46 | Properties.debounce = false |
47 | if Properties.anim_check = = true then animation:Play() end |
48 | if Properties.sound_fx = = true then wait(Properties.soundDelay) sound:Play() end |
50 | if Properties.enableTrail = = true then |
51 | Properties.trail.Enabled = true |
53 | Properties.trail.Enabled = false |
56 | script.Parent.Head.Touched:Connect( function (Hit) |
58 | if Hit:FindFirstChildWhichIsA( "NumberValue" ) and Hit:FindFirstChildWhichIsA( "NumberValue" ).Name = = "Health" then |
59 | local temp = Hit:FindFirstChildWhichIsA( "NumberValue" ) |
60 | print (temp.Name .. ": " .. temp.Value) |
61 | temp.Value = temp.Value - Properties.damage |
65 | wait(Properties.debounce_lenght) |
66 | Properties.debounce = true |
70 | Tool.Unequipped:Connect( function () |
71 | if Properties.anim_check = = true then animation:Stop() end |
72 | if Properties.sound_fx then sound:Stop() end |