Well all i'm doing is to subtract a variable when mouse is down and it repeats itself like a loop for like a whole second

local previous = 0 local function MouseClick() if pickaxe == true then mouse.Button1Down:connect(function() local target = mouse.Target local magnitude = 0 if target == nil then print("nothing")

elseif target.Parent:IsA("Model") then
	magnitude = (player.Character.Head.Position - target.Position).magnitude
	if magnitude < 8 and pickaxe == true then
		target:Destroy()
		pickaxesound:Play()
		effectforpick.LightEmission = 1
		effectforpick.LightInfluence = 1
		wait(0.7)
		effectforpick.LightEmission = 0
		effectforpick.LightInfluence = 0
		pickaxesound:Stop()
		if player.PlayerGui.ScreenGui.Slottwo.whatsin.Value == "nothing" then
			player.PlayerGui.ScreenGui.SlottwoQuan.Text = script.Inventory:FindFirstChild(target.Name).Value + 1
			
		end
		local brick = script.Inventory:FindFirstChild(target.Name)
		brick.Value = brick.Value + 0
		local br1ck = script.Inventory:FindFirstChild("BuildingBlock")
		br1ck.Value = br1ck.Value + 0.5
		player.PlayerGui.ScreenGui.Slottwo.whatsin.Value = "BuildingBlock"
		player.PlayerGui.ScreenGui.SlottwoQuan.Text = script.Inventory:FindFirstChild("BuildingBlock").Value
		previous = script.Inventory.BuildingBlock.Value
		else
		if placeobj == true and script.Inventory.BuildingBlock.Value > 0.9 then
if workspace.CurrentCamera.Part.Tag == nil then
	print('Sup')
	
else
	for i = 1,1 do
		script.Inventory.BuildingBlock.Value = script.Inventory.BuildingBlock.Value - 1
	print("hi")
	player.PlayerGui.ScreenGui.SlottwoQuan.Text = script.Inventory.BuildingBlock.Value
	if player.PlayerGui.ScreenGui.Slottwo.whatsin.Value == "BuildingBlock" then
		
		
		local grassplace = Instance.new('Part') grassplace.Size = Vector3.new(4, 4, 4) grassplace.Anchored = true grassplace.BrickColor = BrickColor.new("Ghost grey") grassplace.Parent = workspace grassplace.Position = workspace.CurrentCamera.Part.Position grassplace.Name = "grass" grassplace.CollisionGroupId = 1
		break
	end

	end
end
end

	end
	
end
end)

end