local pickaxe = script.Parent
local canmine = pickaxe.CanMine
local anim = pickaxe.Animation
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character
local animtrack
local humanoid
local ismining = false
local isactive = false
local animplaying = false
local pickaxehitbox = pickaxe.Pickaxepart.PickaxeHitbox
local function CharAdded(char)
character = char
humanoid = character:WaitForChild("Humanoid")
animtrack = humanoid:LoadAnimation(anim)
end
if player.Character then CharAdded(player.Character) end
player.CharacterAdded:Connect(CharAdded)
canmine.Value = true
pickaxe.Activated:Connect(function()
if canmine.Value == true and animplaying == false then
print("activated")
isactive = true
animtrack:Play()
canmine.Value = false
animplaying = true
wait(3)
animplaying = false
pickaxehitbox.Touched:Connect(function(hit)
if ismining == false then
if hit.Name == "Hitbox" or hit.Parent == "Rocks" then
print("mining")
ismining = true
local health = hit.Parent.Health
local healthvalue = health.Value
print(healthvalue)
if health:isA("NumberValue") then
healthvalue = healthvalue - 1
end
if ismining == true then
wait(1)
ismining = false
end
end
end
end)
task.wait(1)
canmine.Value = true
end
end)
if isactive == true then
wait(1)
isactive = false
end
i want to change the health value by the mining function but for some reason it doesn’t work, im pretty sure it’s correct but can anyone correct me?