Alright to my issue is. When I add the give leaderstat variables it breaks the mining script. I need it once you Destroy the block by mining it it adds to the "Gold" Leaderstat. Heres the code. So when the block gets removed with d:remove I need it to also add to the Gold Leaderstat. So can someone help me?
function onTouched(part)
local shovel = part.Parent
local d = script.Parent
if (shovel.Name == "Swuvle") then
if (part.Name == "Handle") then
local v = script.Parent.Value
if (v.Value ~= 0) then
v.Value = v.Value - 1
d.Transparency = d.Transparency + 0.5
else
d:remove()
end
end
end
end
script.Parent.Touched:connect(onTouched)

2 comments
':connect()' Is depracted, i'd prefer :Connect(), also i'm gonna help you out. Tell me what the scripts supposed to do.
please don't name string values, or int values, or number values "Value", it gets extremely confusing