intention: every time you click and you are in contact with a part called "CoalOre" it clones the tool: "Coal" from replicated storage once and gives the 1 coal to you by parenting it to your backpack
bug: idk how to explain. first click = gives you one coal, second gives two, third gives 3 etc etc so after 3 clicks you have 6 coal..
local handle = tool.Handle
local hitbox = tool.Hitbox
local repstorage = game:GetService("ReplicatedStorage")
local coal = repstorage.Coal
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local debounce = false
tool.Activated:Connect(function(on)
if not debounce then
debounce = true
if debounce == true then
hitbox.CanTouch = true
hitbox.Touched:Connect(function(hit)
if hit.Name == "CoalOre" then
print("MINE")
local clone = coal:Clone(1)
clone.Parent = player:FindFirstChild("Backpack")
hitbox.CanTouch = false
task.wait(1)
debounce = false
else
return false;
end
end)
end
end
end)```
** You are now Level 8! **