Hey guys, I am trying to make a digging game where if you click a diggable part, it will slowly reduce the size of the part until it is completely gone and when it is gone it will give you coins in return. I have a script that works but for some reason when you walk away from the part, you are still able to dig it even when you are not touching it. Anyone know how I am fix this?
Script:
--Script in ServerScriptService
ce.OnServerEvent:Connect(function(plr, part)
part.Size = part.Size - Vector3.new(.01,.01,.01)
end)
--Script in tool
script.Parent.ShovelTip.Touched:Connect(function(hitpart)
mouse.Button1Down:Connect(function()
if hitpart.Name == "Dirt" then
local part = hitpart
harvesting.Value = true
ce:FireServer(part)
end
end)
end)

1 comment
The reason is because you need to use the
Remove()Function. This way it would decrease lag as well because you wouldn't have a million parts in explorer.