Value==>Mining
local tool = script.Parent
local function mine()
local str = Instance.new("StringValue")
str.Name = "toolanim"
str.Value = "Slash"
str.Parent = tool
tool.Mining.Value = true
wait(0.25)
tool.Mining.Value = false
end
tool.Activated:Connect(mine)
local label = script.Parent.Health
local rock = script.Parent
local hit_sound = rock.Hit
local swingsLeft = 10
local function onTouch(otherPart)
local tool = otherPart.Parent
if tool:IsA('Tool') and tool.Mining.Value == true then
hit_sound:Play()
swingsLeft -= 1
label.Green.Size = UDim2.new(swingsLeft/10, 0, 1, 0)
end
if swingsLeft <= 0 then
rock:Destroy()
end
end
rock.Touched:Connect(onTouch)